IVGCVSW-5940 Enabling NN Driver dumps results in a driver segfault
* Added checks to SerializerStrategy::CreateTensorInfo to handle situations
where a shape has some unspecified dimensions
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Idc64bfdabd5677c73a5c64f0c8e80156f3aae8e2
diff --git a/src/armnnSerializer/Serializer.cpp b/src/armnnSerializer/Serializer.cpp
index b742cd8..944797f 100644
--- a/src/armnnSerializer/Serializer.cpp
+++ b/src/armnnSerializer/Serializer.cpp
@@ -1674,17 +1674,21 @@
{
// Get the dimensions
std::vector<unsigned int> shape;
- for(unsigned int dim = 0; dim < tensorInfo.GetShape().GetNumDimensions(); ++dim)
- {
- shape.push_back(tensorInfo.GetShape()[dim]);
- }
-
std::vector<bool> specificity;
// This assumes that the TensorShape constructors have ensured that the size of m_DimensionsSpecificity
// matches the size of dimensions.
for(unsigned int dim = 0; dim < tensorInfo.GetShape().GetNumDimensions(); ++dim)
{
specificity.push_back(tensorInfo.GetShape().GetDimensionSpecificity(dim));
+
+ if (tensorInfo.GetShape().GetDimensionSpecificity(dim))
+ {
+ shape.push_back(tensorInfo.GetShape()[dim]);
+ }
+ else
+ {
+ shape.push_back(0);
+ }
}
if (tensorInfo.HasPerAxisQuantization())