aboutsummaryrefslogtreecommitdiff
path: root/src/backends/aclCommon
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2020-02-28 18:11:58 +0000
committermike.kelly <mike.kelly@arm.com>2020-03-02 16:44:09 +0000
commitc9ea45adefdde2890e9aa191a5b31563a3dd35ea (patch)
tree2ea65c972d24cc2d823ea39eb105d4062db54934 /src/backends/aclCommon
parent510f6183d289b176702a18f020449c68be6f1075 (diff)
downloadarmnn-c9ea45adefdde2890e9aa191a5b31563a3dd35ea.tar.gz
IVGCVSW-4375 Add support for Transpose
* Added TransposeLayer * Added CL, Neon and Ref Workloads * Added Transpose utilities * Added Serializer and Deserializer support * Added Quantizer support Signed-off-by: Mike Kelly <mike.kelly@arm.com> Change-Id: I04c755ba7cb5b1edf72b3c9f3c0314878032e3c7
Diffstat (limited to 'src/backends/aclCommon')
-rw-r--r--src/backends/aclCommon/ArmComputeTensorUtils.cpp27
-rw-r--r--src/backends/aclCommon/ArmComputeTensorUtils.hpp3
2 files changed, 30 insertions, 0 deletions
diff --git a/src/backends/aclCommon/ArmComputeTensorUtils.cpp b/src/backends/aclCommon/ArmComputeTensorUtils.cpp
index 49fef5bf17..84091e8fb3 100644
--- a/src/backends/aclCommon/ArmComputeTensorUtils.cpp
+++ b/src/backends/aclCommon/ArmComputeTensorUtils.cpp
@@ -214,7 +214,34 @@ arm_compute::PermutationVector BuildArmComputePermutationVector(const armnn::Per
{
aclPerm.set(i - start, perm[i] - start);
}
+ return aclPerm;
+}
+
+arm_compute::PermutationVector BuildArmComputeTransposeVector(const armnn::PermutationVector& perm)
+{
+ arm_compute::PermutationVector aclPerm;
+ std::map<unsigned int, unsigned int> permuteMappings;
+ for (unsigned int i = 0; i < perm.GetSize(); ++i)
+ {
+ permuteMappings[perm[i]] = i;
+ }
+
+ std::vector<unsigned int> permuteVector;
+ for (unsigned int i = 0; i < perm.GetSize(); ++i)
+ {
+ permuteVector.push_back(permuteMappings.at(i));
+ }
+ unsigned int start = 0;
+ while ((start < perm.GetSize()) && (start == permuteVector[start]))
+ {
+ ++start;
+ }
+
+ for (unsigned int i = start; i < perm.GetSize(); ++i)
+ {
+ aclPerm.set(i - start, permuteVector[i] - start);
+ }
return aclPerm;
}
diff --git a/src/backends/aclCommon/ArmComputeTensorUtils.hpp b/src/backends/aclCommon/ArmComputeTensorUtils.hpp
index b4ff0f72ff..9b236e1eed 100644
--- a/src/backends/aclCommon/ArmComputeTensorUtils.hpp
+++ b/src/backends/aclCommon/ArmComputeTensorUtils.hpp
@@ -60,6 +60,9 @@ arm_compute::NormalizationLayerInfo BuildArmComputeNormalizationLayerInfo(const
/// Utility function used to setup an arm_compute::PermutationVector object from an armnn::PermutationVector.
arm_compute::PermutationVector BuildArmComputePermutationVector(const armnn::PermutationVector& vector);
+/// Utility function used to setup an arm_compute::PermutationVector object from an armnn::PermutationVector.
+arm_compute::PermutationVector BuildArmComputeTransposeVector(const armnn::PermutationVector& vector);
+
/// Utility function used to setup an arm_compute::Size2D object from width and height values.
arm_compute::Size2D BuildArmComputeSize2D(const unsigned int width, const unsigned int height);