ArmNN
 24.02
RefElementwiseWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2018-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "Decoders.hpp"
10 #include "Encoders.hpp"
11 #include "Profiling.hpp"
12 #include "RefWorkloadUtils.hpp"
13 #include "StringMapping.hpp"
14 #include <ResolveType.hpp>
15 #include <vector>
16 
17 namespace armnn
18 {
19 
20 template <typename Functor, typename ParentDescriptor, typename armnn::StringMapping::Id DebugString>
22  const ParentDescriptor& desc,
23  const WorkloadInfo& info)
24  : RefBaseWorkload<ParentDescriptor>(desc, info)
25 {
26 }
27 
28 template <typename Functor, typename ParentDescriptor, typename armnn::StringMapping::Id DebugString>
30 {
31  Execute(m_Data.m_Inputs, m_Data.m_Outputs);
32 }
33 
34 template <typename Functor, typename ParentDescriptor, typename armnn::StringMapping::Id DebugString>
36  ExecutionData& executionData)
37 {
38  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
39  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
40 }
41 
42 template <typename Functor, typename ParentDescriptor, typename armnn::StringMapping::Id DebugString>
44  std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
45 {
47  const TensorInfo& inputInfo0 = GetTensorInfo(inputs[0]);
48  const TensorInfo& inputInfo1 = GetTensorInfo(inputs[1]);
49  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
50 
51  const TensorShape& inShape0 = inputInfo0.GetShape();
52  const TensorShape& inShape1 = inputInfo1.GetShape();
53  const TensorShape& outShape = outputInfo.GetShape();
54 
55  std::unique_ptr<Decoder<InType>> input0 = MakeDecoder<InType>(inputInfo0, inputs[0]->Map());
56  std::unique_ptr<Decoder<InType>> input1 = MakeDecoder<InType>(inputInfo1, inputs[1]->Map());
57  std::unique_ptr<Encoder<OutType>> output= MakeEncoder<OutType>(outputInfo, outputs[0]->Map());
58 
60  inShape1,
61  outShape,
62  *input0,
63  *input1,
64  *output);
65 }
66 
67 } //namespace armnn
68 
72 
76 
80 
84 
88 
92 
96 
100 
104 
108 
112 
armnn::StringMapping::RefMaximumWorkload_Execute
@ RefMaximumWorkload_Execute
Definition: StringMapping.hpp:22
armnn::DivisionQueueDescriptor
Definition: WorkloadData.hpp:270
armnn::MaximumQueueDescriptor
Definition: WorkloadData.hpp:282
armnn::RefElementwiseWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefElementwiseWorkload.cpp:35
armnn::MultiplicationQueueDescriptor
Definition: WorkloadData.hpp:264
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::StringMapping::RefDivisionWorkload_Execute
@ RefDivisionWorkload_Execute
Definition: StringMapping.hpp:21
armnn::RefElementwiseWorkload::Execute
void Execute() const override
Definition: RefElementwiseWorkload.cpp:29
armnn::StringMapping::RefAdditionWorkload_Execute
@ RefAdditionWorkload_Execute
Definition: StringMapping.hpp:20
Profiling.hpp
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::StringMapping::RefMultiplicationWorkload_Execute
@ RefMultiplicationWorkload_Execute
Definition: StringMapping.hpp:24
armnn::ElementwiseBinaryFunction
Definition: ElementwiseFunction.hpp:15
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::StringMapping::RefSubtractionWorkload_Execute
@ RefSubtractionWorkload_Execute
Definition: StringMapping.hpp:25
armnn::RefElementwiseWorkload::RefElementwiseWorkload
RefElementwiseWorkload(const ParentDescriptor &descriptor, const WorkloadInfo &info)
Definition: RefElementwiseWorkload.cpp:21
armnn::StringMapping::RefMinimumWorkload_Execute
@ RefMinimumWorkload_Execute
Definition: StringMapping.hpp:23
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::AdditionQueueDescriptor
Definition: WorkloadData.hpp:258
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::BoostLogSeverityMapping::info
@ info
RefElementwiseWorkload.hpp
RefWorkloadUtils.hpp
armnn::SubtractionQueueDescriptor
Definition: WorkloadData.hpp:276
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
ElementwiseFunction.hpp
armnn::StringMapping::Instance
static const StringMapping & Instance()
Definition: StringMapping.cpp:11
Decoders.hpp
armnn::LayerType::Map
@ Map
StringMapping.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::MinimumQueueDescriptor
Definition: WorkloadData.hpp:473
armnn::RefElementwiseWorkload
Definition: RefElementwiseWorkload.hpp:21
Encoders.hpp
armnn::RefBaseWorkload
Definition: RefBaseWorkload.hpp:13
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14