aboutsummaryrefslogtreecommitdiff
path: root/src/backends/neon/workloads/NeonWorkloadUtils.hpp
diff options
context:
space:
mode:
authorjosh minor <josh.minor@arm.com>2019-11-15 14:53:22 -0600
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-11-19 11:38:35 +0000
commit036f02d859c307f514c77e91665fbff05048ba11 (patch)
tree88b82ad93b797bdcdd3b9dec150a44a1d17ee01d /src/backends/neon/workloads/NeonWorkloadUtils.hpp
parent49d0f1209e2494fcbc4c807af49322a66fee4d20 (diff)
downloadarmnn-036f02d859c307f514c77e91665fbff05048ba11.tar.gz
IVGCVSW-3729 Added neon slice workload and supporting neon layer tests
* Support added for ACL neon slice workload * Utility function created to translate ArmNN slice layer params to ACL neon slice layer equivalent * Neon slice layer tests added as per SliceTestImpl.hpp Signed-off-by: josh minor <josh.minor@arm.com> Change-Id: Id583465311879af139e8e977f16ed2280c937ac7
Diffstat (limited to 'src/backends/neon/workloads/NeonWorkloadUtils.hpp')
-rw-r--r--src/backends/neon/workloads/NeonWorkloadUtils.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/backends/neon/workloads/NeonWorkloadUtils.hpp b/src/backends/neon/workloads/NeonWorkloadUtils.hpp
index 8cf97d3909..f63946ec07 100644
--- a/src/backends/neon/workloads/NeonWorkloadUtils.hpp
+++ b/src/backends/neon/workloads/NeonWorkloadUtils.hpp
@@ -76,4 +76,28 @@ inline auto SetNeonStridedSliceData(const std::vector<int>& m_begin,
return std::make_tuple(starts, ends, strides);
}
+inline auto SetNeonSliceData(const std::vector<unsigned int>& m_begin,
+ const std::vector<unsigned int>& m_size)
+{
+ // This function must translate the size vector given to an end vector
+ // expected by the ACL NESlice workload
+ arm_compute::Coordinates starts;
+ arm_compute::Coordinates ends;
+
+ unsigned int num_dims = static_cast<unsigned int>(m_begin.size());
+
+ // For strided slices, we have the relationship size = (end - begin) / stride
+ // For slice, we assume stride to be a vector of all ones, yielding the formula
+ // size = (end - begin) therefore we know end = size + begin
+ for (unsigned int i = 0; i < num_dims; i++)
+ {
+ unsigned int revertedIndex = num_dims - i - 1;
+
+ starts.set(i, static_cast<int>(m_begin[revertedIndex]));
+ ends.set(i, static_cast<int>(m_begin[revertedIndex] + m_size[revertedIndex]));
+ }
+
+ return std::make_tuple(starts, ends);
+}
+
} //namespace armnn