From 3b504ef58b6893899a23810eba68db6663ce5f94 Mon Sep 17 00:00:00 2001 From: Jakub Sujak Date: Wed, 7 Dec 2022 23:55:22 +0000 Subject: Update libnpy header external dependency to the latest version Primarily fixes build error when building with Clang14 due to warning of use of deprecated 'sprintf' function Resolves: COMPMID-5803 Change-Id: Iaa7df7ccc482fbeaa1978988ce61bbc8fd792ca1 Signed-off-by: Jakub Sujak Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8802 Reviewed-by: Pablo Marquez Tello Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- utils/Utils.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'utils/Utils.h') diff --git a/utils/Utils.h b/utils/Utils.h index d46fbc3633..e3a5bb2c3c 100644 --- a/utils/Utils.h +++ b/utils/Utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021 Arm Limited. + * Copyright (c) 2016-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -143,7 +143,7 @@ std::tuple parse_ppm_header(std::ifstream &fs); * * @return The width and height stored in the header of the NPY file */ -std::tuple, bool, std::string> parse_npy_header(std::ifstream &fs); +npy::header_t parse_npy_header(std::ifstream &fs); /** Obtain numpy type string from DataType. * @@ -305,7 +305,10 @@ public: _fs.exceptions(std::ifstream::failbit | std::ifstream::badbit); _file_layout = file_layout; - std::tie(_shape, _fortran_order, _typestring) = parse_npy_header(_fs); + npy::header_t header = parse_npy_header(_fs); + _shape = header.shape; + _fortran_order = header.fortran_order; + _typestring = header.dtype.str(); } catch(const std::ifstream::failure &e) { @@ -603,11 +606,11 @@ void save_to_npy(T &tensor, const std::string &npy_filename, bool fortran_order) using typestring_type = typename std::conditional::value, float, qasymm8_t>::type; std::vector tmp; /* Used only to get the typestring */ - npy::Typestring typestring_o{ tmp }; - std::string typestring = typestring_o.str(); + const npy::dtype_t dtype = npy::dtype_map.at(std::type_index(typeid(tmp))); std::ofstream stream(npy_filename, std::ofstream::binary); - npy::write_header(stream, typestring, fortran_order, shape); + npy::header_t header{ dtype, fortran_order, shape }; + npy::write_header(stream, header); arm_compute::Window window; window.use_tensor_dimensions(tensor.info()->tensor_shape()); -- cgit v1.2.1