From cac13b1cfd593889271f8e2191be2039b8d88f36 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 27 Apr 2018 19:07:19 +0100 Subject: COMPMID-1097: Port mobilenet to NHWC Change-Id: I789065bfa0d4ef133388e1904c5caf31e450f80f Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129495 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- utils/GraphUtils.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'utils/GraphUtils.h') diff --git a/utils/GraphUtils.h b/utils/GraphUtils.h index 11f1e0590a..a8507b1ac7 100644 --- a/utils/GraphUtils.h +++ b/utils/GraphUtils.h @@ -201,9 +201,10 @@ class NumPyBinLoader final : public graph::ITensorAccessor public: /** Default Constructor * - * @param filename Binary file name + * @param[in] filename Binary file name + * @param[in] file_layout (Optional) Layout of the numpy tensor data. Defaults to NCHW */ - NumPyBinLoader(std::string filename); + NumPyBinLoader(std::string filename, DataLayout file_layout = DataLayout::NCHW); /** Allows instances to move constructed */ NumPyBinLoader(NumPyBinLoader &&) = default; @@ -212,6 +213,7 @@ public: private: const std::string _filename; + const DataLayout _file_layout; }; /** Generates appropriate random accessor @@ -231,12 +233,15 @@ inline std::unique_ptr get_random_accessor(PixelValue lo * * @note If path is empty will generate a DummyAccessor else will generate a NumPyBinLoader * - * @param[in] path Path to the data files - * @param[in] data_file Relative path to the data files from path + * @param[in] path Path to the data files + * @param[in] data_file Relative path to the data files from path + * @param[in] file_layout (Optional) Layout of file. Defaults to NCHW * * @return An appropriate tensor accessor */ -inline std::unique_ptr get_weights_accessor(const std::string &path, const std::string &data_file) +inline std::unique_ptr get_weights_accessor(const std::string &path, + const std::string &data_file, + DataLayout file_layout = DataLayout::NCHW) { if(path.empty()) { @@ -244,7 +249,7 @@ inline std::unique_ptr get_weights_accessor(const std::s } else { - return arm_compute::support::cpp14::make_unique(path + data_file); + return arm_compute::support::cpp14::make_unique(path + data_file, file_layout); } } -- cgit v1.2.1