diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2020-12-30 10:12:35 -0800 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-01-04 09:32:10 -0800 |
commit | 4025315d4d09e314e46b037f8c47e2096b20ddf8 (patch) | |
tree | 1f76b061532c9664cf1ecb2d2bdef51bb008b768 | |
parent | 77d0f76b42c6353459d3271ccba9e41728d066cd (diff) | |
download | reference_model-4025315d4d09e314e46b037f8c47e2096b20ddf8.tar.gz |
Numpy utility supports scalar (rank 0) .npy
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: I4f53a83a0de333bd851fae4e894eb87b94902637
-rw-r--r-- | serialization/tosa_serialization_handler.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/serialization/tosa_serialization_handler.cpp b/serialization/tosa_serialization_handler.cpp index 7fe9f47..ad33d23 100644 --- a/serialization/tosa_serialization_handler.cpp +++ b/serialization/tosa_serialization_handler.cpp @@ -1225,8 +1225,14 @@ NumpyUtilities::NPError NumpyUtilities::checkNpyHeader(FILE* infile, const uint3 if (!ptr) break; - shape.push_back(atoi(ptr)); - totalElems *= atoi(ptr); + int dim = atoi(ptr); + + // Dimension is 0 + if (dim == 0) + break; + + shape.push_back(dim); + totalElems *= dim; ptr = strtok_r(NULL, ",", &end); } |