blob: 75e9d0acf0b0228c3fd153fec1919000bec69974 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa014fcda012018-03-09 14:13:49 +00004//
5
6#include "RefPermuteWorkload.hpp"
7#include "RefWorkloadUtils.hpp"
8
Matteo Martincighe011d202019-11-28 11:35:47 +00009#include <armnnUtils/Permute.hpp>
10
Aron Virginas-Tard4f0fea2019-04-09 14:08:06 +010011#include <ResolveType.hpp>
telsoa014fcda012018-03-09 14:13:49 +000012
13namespace armnn
14{
15
16template <armnn::DataType DataType>
17void 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];
Matthew Bentham4cefc412019-06-18 16:14:34 +010024 ITensorHandle* dst = m_Data.m_Outputs[0];
telsoa014fcda012018-03-09 14:13:49 +000025 const PermutationVector& mappings = m_Data.m_Parameters.m_DimMappings;
26
Matteo Martincighd5b9e642019-01-04 18:01:21 +000027 armnnUtils::Permute(GetTensorInfo(dst).GetShape(), mappings,
Matthew Bentham4cefc412019-06-18 16:14:34 +010028 src->Map(), dst->Map(), sizeof(T));
telsoa014fcda012018-03-09 14:13:49 +000029}
30
Narumol Prangnawarat44179c32020-03-11 14:51:27 +000031template class RefPermuteWorkload<DataType::BFloat16>;
arovir01616e7752018-10-01 17:08:59 +010032template class RefPermuteWorkload<DataType::Float16>;
telsoa014fcda012018-03-09 14:13:49 +000033template class RefPermuteWorkload<DataType::Float32>;
Sadik Armagan303980c2020-04-17 12:45:14 +010034template class RefPermuteWorkload<DataType::QAsymmS8>;
Derek Lambertif90c56d2020-01-10 17:14:08 +000035template class RefPermuteWorkload<DataType::QAsymmU8>;
36template class RefPermuteWorkload<DataType::QSymmS16>;
telsoa014fcda012018-03-09 14:13:49 +000037
38} //namespace armnn