diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-01-22 11:20:44 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:43:42 +0000 |
commit | 7f530b3eb847f7d4d5339914ad0da0287927a8c5 (patch) | |
tree | 57faae16fba6cee5f6dd8efd36426617e1cf5f4d /utils/GraphUtils.cpp | |
parent | 6c6e77afc0059e4c5a59d97215acccdedf473a7f (diff) | |
download | ComputeLibrary-7f530b3eb847f7d4d5339914ad0da0287927a8c5.tar.gz |
COMPMID-847: Add MobileNet_v1_0.75_160.
Change-Id: Ib21de61fe39d2768638af11c067dfc7bcf63aae2
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/117112
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'utils/GraphUtils.cpp')
-rw-r--r-- | utils/GraphUtils.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
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<int>(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 |