24.08
RefSoftmaxWorkload.cpp
Go to the documentation of this file.
1
//
2
// Copyright © 2017-2023 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
20
void
RefSoftmaxWorkload::Execute
()
const
21
{
22
Execute
(
m_Data
.
m_Inputs
,
m_Data
.
m_Outputs
);
23
}
24
25
void
RefSoftmaxWorkload::ExecuteAsync
(
ExecutionData
& executionData)
26
{
27
WorkingMemDescriptor
* workingMemDescriptor =
static_cast<
WorkingMemDescriptor
*
>
(executionData.
m_Data
);
28
Execute
(workingMemDescriptor->
m_Inputs
, workingMemDescriptor->
m_Outputs
);
29
}
30
31
void
RefSoftmaxWorkload::Execute
(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs)
const
32
{
33
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
(
"RefSoftmaxWorkload_Execute"
);
34
35
const
TensorInfo
&inputTensorInfo =
GetTensorInfo
(inputs[0]);
36
37
std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, inputs[0]->
Map
());
38
Decoder<float>
&decoder = *decoderPtr;
39
40
const
TensorInfo
&outputTensorInfo =
GetTensorInfo
(outputs[0]);
41
42
std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputTensorInfo, outputs[0]->
Map
());
43
Encoder<float>
&encoder = *encoderPtr;
44
45
Softmax
(decoder,
46
encoder,
47
inputTensorInfo,
48
m_Data
.
m_Parameters
.
m_Beta
,
49
m_Data
.
m_Parameters
.
m_Axis
);
50
}
51
}
//namespace armnn
armnn::Decoder< float >
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition:
ExecutionData.hpp:16
armnn::SoftmaxDescriptor::m_Beta
float m_Beta
Exponentiation value.
Definition:
Descriptors.hpp:190
armnn::TensorInfo
Definition:
Tensor.hpp:152
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
armnn::Encoder< float >
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition:
WorkloadData.hpp:66
armnn::RefSoftmaxWorkload::Execute
void Execute() const override
Definition:
RefSoftmaxWorkload.cpp:20
armnn::RefSoftmaxWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition:
RefSoftmaxWorkload.cpp:25
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition:
RefWorkloadUtils.hpp:33
armnn::Softmax
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
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition:
WorkloadData.hpp:27
RefWorkloadUtils.hpp
Softmax.hpp
armnn::BaseWorkload< SoftmaxQueueDescriptor >::m_Data
SoftmaxQueueDescriptor m_Data
Definition:
Workload.hpp:89
armnn::SoftmaxDescriptor::m_Axis
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
Definition:
Descriptors.hpp:192
RefSoftmaxWorkload.hpp
Decoders.hpp
armnn::LayerType::Map
@ Map
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
Encoders.hpp
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition:
WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition:
WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition:
ExecutionData.hpp:14
src
backends
reference
workloads
RefSoftmaxWorkload.cpp
Generated on Wed Aug 28 2024 14:31:51 for Arm NN by
1.8.17