Allow reading numpy files with up to 10 dimensions.
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: Id6ee2aab2dd62b44e72b60218e4f03dc9a933d10
diff --git a/src/numpy_utils.cpp b/src/numpy_utils.cpp
index e438235..3c85ae1 100644
--- a/src/numpy_utils.cpp
+++ b/src/numpy_utils.cpp
@@ -18,6 +18,8 @@
// Magic NUMPY header
static const char NUMPY_HEADER_STR[] = "\x93NUMPY\x1\x0\x76\x0{";
static const int NUMPY_HEADER_SZ = 128;
+// Maximum shape dimensions supported
+static const int NUMPY_MAX_DIMS_SUPPORTED = 10;
NumpyUtilities::NPError NumpyUtilities::readFromNpyFile(const char* filename, const uint32_t elems, bool* databuf)
{
@@ -189,11 +191,11 @@
while (isspace(*ptr))
ptr++;
- // The shape contains N comma-separated integers. Read up to 4.
+ // The shape contains N comma-separated integers. Read up to MAX_DIMS.
char* end = NULL;
ptr = strtok_r(ptr, ",", &end);
- for (int i = 0; i < 4; i++)
+ for (int i = 0; i < NUMPY_MAX_DIMS_SUPPORTED; i++)
{
// Out of dimensions
if (!ptr)