From ad486e21e5870f41774f30825c270762e08ae71e Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Tue, 7 Aug 2018 17:17:06 +0100 Subject: COMPMID-1188 - Fixed files extensions in GraphUtils.h Also fixed the calculation of num_elements in access_numpy_tensor Change-Id: Ic1a394ff829746d7803b81360830bade63b6b82a Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/143132 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- utils/GraphUtils.cpp | 2 +- utils/GraphUtils.h | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'utils') diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp index ef09d3da67..573c757aa7 100644 --- a/utils/GraphUtils.cpp +++ b/utils/GraphUtils.cpp @@ -149,7 +149,7 @@ NumPyAccessor::NumPyAccessor(std::string npy_path, TensorShape shape, DataType d template void NumPyAccessor::access_numpy_tensor(ITensor &tensor) { - const int num_elements = tensor.info()->total_size(); + const int num_elements = tensor.info()->tensor_shape().total_size(); int num_mismatches = utils::compare_tensor(tensor, _npy_tensor); float percentage_mismatches = static_cast(num_mismatches) / num_elements; diff --git a/utils/GraphUtils.h b/utils/GraphUtils.h index 6cec2dae4d..52180ca495 100644 --- a/utils/GraphUtils.h +++ b/utils/GraphUtils.h @@ -25,6 +25,7 @@ #define __ARM_COMPUTE_GRAPH_UTILS_H__ #include "arm_compute/core/PixelValue.h" +#include "arm_compute/core/Utils.h" #include "arm_compute/core/utils/misc/Utility.h" #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/ITensorAccessor.h" @@ -403,14 +404,15 @@ inline std::unique_ptr get_input_accessor(const arm_comp } else { - const std::string &image_file = graph_parameters.image; - if(arm_compute::utility::endswith(image_file, ".npy")) + const std::string &image_file = graph_parameters.image; + const std::string &image_file_lower = lower_string(image_file); + if(arm_compute::utility::endswith(image_file_lower, ".npy")) { return arm_compute::support::cpp14::make_unique(image_file); } - else if(arm_compute::utility::endswith(image_file, ".jpeg") - || arm_compute::utility::endswith(image_file, ".jpg") - || arm_compute::utility::endswith(image_file, ".ppm")) + else if(arm_compute::utility::endswith(image_file_lower, ".jpeg") + || arm_compute::utility::endswith(image_file_lower, ".jpg") + || arm_compute::utility::endswith(image_file_lower, ".ppm")) { return arm_compute::support::cpp14::make_unique(image_file, bgr, std::move(preprocessor)); } -- cgit v1.2.1