1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2022-08-14 15:50:42 +00:00
37 changed files with 246 additions and 90 deletions
+10
View File
@@ -132,6 +132,16 @@ public:
if (hasWeights && hasBias)
CV_CheckEQ(weights.total(), bias.total(), "Incompatible weights/bias blobs");
if (weights.total() == 1)
{
// The total() of bias should be same as weights.
if (hasBias)
inpBlob.convertTo(outBlob, CV_32F, weights.at<float>(0), bias.at<float>(0));
else
inpBlob.convertTo(outBlob, CV_32F, weights.at<float>(0));
return;
}
int endAxis;
for (endAxis = axis + 1; endAxis <= inpBlob.dims; ++endAxis)
{
+2
View File
@@ -2026,6 +2026,8 @@ void ONNXImporter::parseMatMul(LayerParams& layerParams, const opencv_onnx::Node
void findBroadAxis(const MatShape& broadShape, const MatShape& outShape, size_t& axis, int& broadAxis)
{
// Currently, this function can only complete 1-dimensional expansion of broadShape.
// If there are two dimensions in broadShape that need to be expended, it will fail.
const size_t diff = outShape.size() - broadShape.size();
// find the first non-one element of the broadcasting shape