ArmNN
 25.02
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RefSoftmaxWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "RefSoftmaxWorkload.hpp"
7 
8 #include "Decoders.hpp"
9 #include "Encoders.hpp"
10 #include "RefWorkloadUtils.hpp"
11 #include "Softmax.hpp"
12 
13 #include "Profiling.hpp"
14 
15 #include <vector>
16 
17 namespace armnn
18 {
19 
21 {
23 }
24 
25 void RefSoftmaxWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
26 {
27  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefSoftmaxWorkload_Execute");
28 
29  const TensorInfo &inputTensorInfo = GetTensorInfo(inputs[0]);
30 
31  std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, inputs[0]->Map());
32  Decoder<float> &decoder = *decoderPtr;
33 
34  const TensorInfo &outputTensorInfo = GetTensorInfo(outputs[0]);
35 
36  std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputTensorInfo, outputs[0]->Map());
37  Encoder<float> &encoder = *encoderPtr;
38 
39  Softmax(decoder,
40  encoder,
41  inputTensorInfo,
42  m_Data.m_Parameters.m_Beta,
43  m_Data.m_Parameters.m_Axis);
44 }
45 } //namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
QueueDescriptor m_Data
Definition: Workload.hpp:74
void Execute() const override
Copyright (c) 2021 ARM Limited and Contributors.
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
void Softmax(Decoder< float > &in, Encoder< float > &out, const TensorInfo &inputTensorInfo, float beta, int axis)
Computes the softmax function on some inputs, into outputs, with a shape given by tensorInfo.
Definition: Softmax.cpp:17
std::vector< ITensorHandle * > m_Inputs
std::vector< ITensorHandle * > m_Outputs