ArmNN
 24.08
RefPermuteWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. 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>
18 {
19  Execute(m_Data.m_Inputs, m_Data.m_Outputs);
20 }
21 
22 template <armnn::DataType DataType>
24 {
25  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
26  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
27 }
28 
29 template <armnn::DataType DataType>
30 void RefPermuteWorkload<DataType>::Execute(std::vector<ITensorHandle*> inputs,
31  std::vector<ITensorHandle*> outputs) const
32 {
33  using T = ResolveType<DataType>;
34 
35  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefPermuteWorkload_Execute");
36 
37  const ITensorHandle* src = inputs[0];
38  ITensorHandle* dst = outputs[0];
39  const PermutationVector& mappings = m_Data.m_Parameters.m_DimMappings;
40 
41  armnnUtils::Permute(GetTensorInfo(dst).GetShape(), mappings,
42  src->Map(), dst->Map(), sizeof(T));
43 }
44 
45 template class RefPermuteWorkload<DataType::BFloat16>;
46 template class RefPermuteWorkload<DataType::Float16>;
47 template class RefPermuteWorkload<DataType::Float32>;
48 template class RefPermuteWorkload<DataType::QAsymmS8>;
49 template class RefPermuteWorkload<DataType::QAsymmU8>;
50 template class RefPermuteWorkload<DataType::QSymmS16>;
51 
52 } //namespace armnn
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
ResolveType.hpp
armnnUtils::Permute
void Permute(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
Definition: Permute.cpp:164
RefPermuteWorkload.hpp
armnn::RefPermuteWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefPermuteWorkload.cpp:23
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::ResolveType
typename ResolveTypeImpl< DT >::Type ResolveType
Definition: ResolveType.hpp:79
armnn::PermutationVector
Definition: Types.hpp:314
Permute.hpp
RefWorkloadUtils.hpp
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::RefPermuteWorkload::Execute
void Execute() const override
Definition: RefPermuteWorkload.cpp:17
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::ITensorHandle::Map
virtual const void * Map(bool blocking=true) const =0
Map the tensor data for access.
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14