4e7b76bf0a9554c1d2fbd6bedf2ca5927880d8f2
[platform/upstream/armnn.git] / src / backends / reference / workloads / RefPermuteWorkload.cpp
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5
6 #include "RefPermuteWorkload.hpp"
7 #include "RefWorkloadUtils.hpp"
8
9 #include <armnnUtils/Permute.hpp>
10
11 #include <ResolveType.hpp>
12
13 namespace armnn
14 {
15
16 template <armnn::DataType DataType>
17 void RefPermuteWorkload<DataType>::Execute() const
18 {
19     using T = ResolveType<DataType>;
20
21     ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, GetName() + "_Execute");
22
23     const ITensorHandle*     src      = m_Data.m_Inputs[0];
24     ITensorHandle*           dst      = m_Data.m_Outputs[0];
25     const PermutationVector& mappings = m_Data.m_Parameters.m_DimMappings;
26
27     armnnUtils::Permute(GetTensorInfo(dst).GetShape(), mappings,
28                         src->Map(), dst->Map(), sizeof(T));
29 }
30
31 template class RefPermuteWorkload<DataType::Float16>;
32 template class RefPermuteWorkload<DataType::Float32>;
33 template class RefPermuteWorkload<DataType::QuantisedAsymm8>;
34 template class RefPermuteWorkload<DataType::QuantisedSymm16>;
35
36 } //namespace armnn