From 7f530b3eb847f7d4d5339914ad0da0287927a8c5 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 22 Jan 2018 11:20:44 +0000 Subject: COMPMID-847: Add MobileNet_v1_0.75_160. Change-Id: Ib21de61fe39d2768638af11c067dfc7bcf63aae2 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/117112 Tested-by: Jenkins Reviewed-by: Michalis Spyrou --- utils/GraphUtils.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'utils') diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp index 2ff40b7fbb..e248929cc2 100644 --- a/utils/GraphUtils.cpp +++ b/utils/GraphUtils.cpp @@ -330,22 +330,35 @@ bool NumPyBinLoader::access_tensor(ITensor &tensor) std::string expect_typestr = arm_compute::utils::get_typestring(tensor.info()->data_type()); ARM_COMPUTE_ERROR_ON_MSG(typestr != expect_typestr, "Typestrings mismatch"); - // Validate tensor shape - ARM_COMPUTE_ERROR_ON_MSG(shape.size() != tensor_shape.num_dimensions(), "Tensor ranks mismatch"); + // Reverse vector in case of non fortran order + if(!fortran_order) + { + std::reverse(shape.begin(), shape.end()); + } - if(fortran_order) + // Correct dimensions (Needs to match TensorShape dimension corrections) + if(shape.size() != tensor_shape.num_dimensions()) { - for(size_t i = 0; i < shape.size(); ++i) + for(int i = static_cast(shape.size()) - 1; i > 0; --i) { - ARM_COMPUTE_ERROR_ON_MSG(tensor_shape[i] != shape[i], "Tensor dimensions mismatch"); + if(shape[i] == 1) + { + shape.pop_back(); + } + else + { + break; + } } } - else + + // Validate tensor ranks + ARM_COMPUTE_ERROR_ON_MSG(shape.size() != tensor_shape.num_dimensions(), "Tensor ranks mismatch"); + + // Validate shapes + for(size_t i = 0; i < shape.size(); ++i) { - for(size_t i = 0; i < shape.size(); ++i) - { - ARM_COMPUTE_ERROR_ON_MSG(tensor_shape[i] != shape[shape.size() - i - 1], "Tensor dimensions mismatch"); - } + ARM_COMPUTE_ERROR_ON_MSG(tensor_shape[i] != shape[i], "Tensor dimensions mismatch"); } // Read data -- cgit v1.2.1