aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/test/DataLayoutUtils.hpp
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2021-10-18 13:07:49 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2021-10-20 16:03:04 +0100
commit5d7b0a314b3e354a6cbcf15f5dd78b50f1e02774 (patch)
tree3d844c4575193ffddfe3a17c51cb808c9f16ddb0 /src/backends/backendsCommon/test/DataLayoutUtils.hpp
parent73010788725f8f07efb6df20711ece712ee213ea (diff)
downloadarmnn-5d7b0a314b3e354a6cbcf15f5dd78b50f1e02774.tar.gz
Add ConstTensorsAsInput support for Conv3d
* Constant weights and biases are now stored as Constant layers. * Updated Serializer, Deserializer and unit tests to reflect this. * Updated TfLiteParser. * Updated Ref backend to handle constant weights and bias as inputs rather than reading from member variables. * Added Conv3d EndToEnd test. * Added NCDHW DataLayout and unit tests. Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: I10cdd354ca5f1c748730f92ffdb36bf810f83c8e
Diffstat (limited to 'src/backends/backendsCommon/test/DataLayoutUtils.hpp')
-rw-r--r--src/backends/backendsCommon/test/DataLayoutUtils.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/test/DataLayoutUtils.hpp b/src/backends/backendsCommon/test/DataLayoutUtils.hpp
index 9411212f4f..89b3900979 100644
--- a/src/backends/backendsCommon/test/DataLayoutUtils.hpp
+++ b/src/backends/backendsCommon/test/DataLayoutUtils.hpp
@@ -34,3 +34,27 @@ void PermuteTensorNhwcToNchw(armnn::TensorInfo& tensorInfo, std::vector<T>& tens
tensorData = tmp;
}
+
+template<typename T>
+void PermuteTensorNdhwcToNcdhw(armnn::TensorInfo& tensorInfo, std::vector<T>& tensorData)
+{
+ const armnn::PermutationVector ndhwcToNcdhw = { 0, 2, 3, 4, 1 };
+
+ tensorInfo = armnnUtils::Permuted(tensorInfo, ndhwcToNcdhw);
+
+ std::vector<T> tmp(tensorData.size());
+ armnnUtils::Permute(tensorInfo.GetShape(), ndhwcToNcdhw, tensorData.data(), tmp.data(), sizeof(T));
+ tensorData = tmp;
+}
+
+template<typename T>
+void PermuteTensorNcdhwToNdhwc(armnn::TensorInfo& tensorInfo, std::vector<T>& tensorData)
+{
+ const armnn::PermutationVector ncdhwToNdhwc = { 0, 4, 1, 2, 3 };
+
+ tensorInfo = armnnUtils::Permuted(tensorInfo, ncdhwToNdhwc);
+
+ std::vector<T> tmp(tensorData.size());
+ armnnUtils::Permute(tensorInfo.GetShape(), ncdhwToNdhwc, tensorData.data(), tmp.data(), sizeof(T));
+ tensorData = tmp;
+}