Release 18.08
[platform/upstream/armnn.git] / src / armnn / backends / RefWorkloads / RefPermuteWorkload.cpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
4 //
5
6 #include "RefPermuteWorkload.hpp"
7 #include "RefWorkloadUtils.hpp"
8
9 #include <Permute.hpp>
10 #include "TypeUtils.hpp"
11
12 namespace armnn
13 {
14
15 template <armnn::DataType DataType>
16 void RefPermuteWorkload<DataType>::Execute() const
17 {
18     using T = ResolveType<DataType>;
19
20     ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, GetName() + "_Execute");
21
22     const ITensorHandle*     src      = m_Data.m_Inputs[0];
23     const ITensorHandle*     dst      = m_Data.m_Outputs[0];
24     const PermutationVector& mappings = m_Data.m_Parameters.m_DimMappings;
25
26     armnnUtils::Permute(GetTensorInfo(dst).GetShape(), mappings, GetConstCpuData<T>(src), GetCpuData<T>(dst));
27 }
28
29 template class RefPermuteWorkload<DataType::Float32>;
30 template class RefPermuteWorkload<DataType::QuantisedAsymm8>;
31
32 } //namespace armnn