ArmNN
 25.11
Loading...
Searching...
No Matches
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
17namespace armnn
18{
19
20template <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
28template <typename Functor, typename ParentDescriptor, typename armnn::StringMapping::Id DebugString>
33
34template <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.
RefBaseWorkload(const ParentDescriptor &descriptor, const WorkloadInfo &info)
RefElementwiseWorkload(const ParentDescriptor &descriptor, const WorkloadInfo &info)
const TensorShape & GetShape() const
Definition Tensor.hpp:193
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< Decoder< T > > MakeDecoder(const TensorInfo &info, const void *data=nullptr)
std::unique_ptr< Encoder< T > > MakeEncoder(const TensorInfo &info, void *data=nullptr)
armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches, unsigned int numberOfChannels, unsigned int height, unsigned int width, const armnn::DataLayout dataLayout, const armnn::DataType dataType)
static const StringMapping & Instance()
Contains information about TensorInfos of a layer.