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
diff --git a/src/backends/backendsCommon/test/DataLayoutUtils.hpp b/src/backends/backendsCommon/test/DataLayoutUtils.hpp
index 9411212..89b3900 100644
--- a/src/backends/backendsCommon/test/DataLayoutUtils.hpp
+++ b/src/backends/backendsCommon/test/DataLayoutUtils.hpp
@@ -34,3 +34,27 @@
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;
+}