diff options
author | Mike Kelly <mike.kelly@arm.com> | 2021-04-26 21:54:55 +0100 |
---|---|---|
committer | mike.kelly <mike.kelly@arm.com> | 2021-05-04 13:53:55 +0000 |
commit | 7780e60b30abe4848222f3c895add1621ad6a160 (patch) | |
tree | e3567cf8aa7fe180cfb181ef75ae70b6c2ec9c3c | |
parent | cfa20ec89e7d4bb141ce4af5b53465dfccf90a1a (diff) | |
download | android-nn-driver-7780e60b30abe4848222f3c895add1621ad6a160.tar.gz |
IVGCVSW-5940 Enabling NN Driver dumps results in a driver segfault
* Added checks to DumpTensor to handle situations where a shape has no
dimensions or some unspecified dimensions
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: If9022a278d138ece12c7e347c61722bf5a2faf3b
-rw-r--r-- | Utils.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -408,7 +408,18 @@ void DumpTensor(const std::string& dumpDir, const unsigned int numDimensions = tensor.GetNumDimensions(); const armnn::TensorShape shape = tensor.GetShape(); + if (!shape.AreAllDimensionsSpecified()) + { + fileStream << "Cannot dump tensor elements: not all dimensions are specified" << std::endl; + return; + } fileStream << "# Number of elements " << tensor.GetNumElements() << std::endl; + + if (numDimensions == 0) + { + fileStream << "# Shape []" << std::endl; + return; + } fileStream << "# Shape [" << shape[0]; for (unsigned int d = 1; d < numDimensions; ++d) { |