ArmNN
 24.08
RefTransposeWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 #include "RefWorkloadUtils.hpp"
8 
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 RefTransposeWorkload<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("RefTransposeWorkload_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::Transpose(GetTensorInfo(src).GetShape(), mappings, src->Map(), dst->Map(), sizeof(T));
42 }
43 
44 template class RefTransposeWorkload<DataType::BFloat16>;
45 template class RefTransposeWorkload<DataType::Float16>;
46 template class RefTransposeWorkload<DataType::Float32>;
47 template class RefTransposeWorkload<DataType::QAsymmS8>;
48 template class RefTransposeWorkload<DataType::QAsymmU8>;
49 template class RefTransposeWorkload<DataType::QSymmS16>;
50 
51 } //namespace armnn
armnnUtils::Transpose
void Transpose(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
Definition: Transpose.cpp:153
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
armnn::RefTransposeWorkload::Execute
void Execute() const override
Definition: RefTransposeWorkload.cpp:17
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
armnn::RefTransposeWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefTransposeWorkload.cpp:23
Transpose.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
RefTransposeWorkload.hpp
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