aboutsummaryrefslogtreecommitdiff
path: root/utils/GraphUtils.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-04-27 19:07:19 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:51:17 +0000
commitcac13b1cfd593889271f8e2191be2039b8d88f36 (patch)
treed1c5196877d7fbd5dcfbb9f9003faf6035f82a33 /utils/GraphUtils.h
parentad0c7388f6261989a268ffb2d042f2bd80736e3f (diff)
downloadComputeLibrary-cac13b1cfd593889271f8e2191be2039b8d88f36.tar.gz
COMPMID-1097: Port mobilenet to NHWC
Change-Id: I789065bfa0d4ef133388e1904c5caf31e450f80f Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129495 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'utils/GraphUtils.h')
-rw-r--r--utils/GraphUtils.h17
1 files changed, 11 insertions, 6 deletions
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<graph::ITensorAccessor> 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<graph::ITensorAccessor> get_weights_accessor(const std::string &path, const std::string &data_file)
+inline std::unique_ptr<graph::ITensorAccessor> 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<graph::ITensorAccessor> get_weights_accessor(const std::s
}
else
{
- return arm_compute::support::cpp14::make_unique<NumPyBinLoader>(path + data_file);
+ return arm_compute::support::cpp14::make_unique<NumPyBinLoader>(path + data_file, file_layout);
}
}