Merge pull request #19477 from LupusSanctus:am/eltwice_vec

* Aligned OpenCV DNN and TF sum op behaviour

Support Mat (shape: [1, m, k, n] ) + Vec (shape: [1, 1, 1, n]) operation
by vec to mat expansion

* Added code corrections: backend, minor refactoring
This commit is contained in:
Anastasia M
2021-03-24 01:16:09 +03:00
committed by GitHub
parent bdd2b57e5d
commit 551d4a8ec1
3 changed files with 121 additions and 3 deletions
@@ -235,6 +235,23 @@ Range normalize_axis_range(const Range& r, int axisSize)
return clamped;
}
static inline
bool isAllOnes(const MatShape &inputShape, int startPos, int endPos)
{
CV_Assert(!inputShape.empty());
CV_CheckGE((int) inputShape.size(), startPos, "");
CV_CheckGE(startPos, 0, "");
CV_CheckLE(startPos, endPos, "");
CV_CheckLE((size_t)endPos, inputShape.size(), "");
for (size_t i = startPos; i < endPos; i++)
{
if (inputShape[i] != 1)
return false;
}
return true;
}
CV__DNN_EXPERIMENTAL_NS_END
}
}