Support Reshape with zero dim
authorLiubov Batanina <piccione-mail@yandex.ru>
Mon, 31 Aug 2020 09:52:55 +0000 (12:52 +0300)
committerLiubov Batanina <piccione-mail@yandex.ru>
Wed, 2 Sep 2020 08:58:43 +0000 (11:58 +0300)
modules/dnn/src/onnx/onnx_importer.cpp

index 8cb2c5e..153d026 100644 (file)
@@ -335,6 +335,10 @@ void ONNXImporter::populateNet(Net dstNet)
         {
             inpShape[j] = tensorShape.dim(j).dim_value();
         }
+        if (!inpShape.empty())
+        {
+            inpShape[0] = std::max(inpShape[0], 1); // It's OK to have undetermined batch size
+        }
         outShapes[valueInfoProto.name()] = inpShape;
     }