ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefElementwiseWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2018-2024 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  std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
37 {
39  const TensorInfo& inputInfo0 = GetTensorInfo(inputs[0]);
40  const TensorInfo& inputInfo1 = GetTensorInfo(inputs[1]);
41  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
42 
43  const TensorShape& inShape0 = inputInfo0.GetShape();
44  const TensorShape& inShape1 = inputInfo1.GetShape();
45  const TensorShape& outShape = outputInfo.GetShape();
46 
47  std::unique_ptr<Decoder<InType>> input0 = MakeDecoder<InType>(inputInfo0, inputs[0]->Map());
48  std::unique_ptr<Decoder<InType>> input1 = MakeDecoder<InType>(inputInfo1, inputs[1]->Map());
49  std::unique_ptr<Encoder<OutType>> output= MakeEncoder<OutType>(outputInfo, outputs[0]->Map());
50 
52  inShape1,
53  outShape,
54  *input0,
55  *input1,
56  *output);
57 }
58 
59 } //namespace armnn
60 
64 
68 
72 
76 
80 
84 
88 
92 
96 
100 
104 
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
RefElementwiseWorkload(const ParentDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
static const StringMapping & Instance()
Contains information about TensorInfos of a layer.