ArmNN
 20.02
ClSoftmaxFloatWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 #include "ClWorkloadUtils.hpp"
8 
10 #include <cl/ClTensorHandle.hpp>
12 
13 namespace armnn
14 {
15 
17  std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
18  : FloatWorkload<SoftmaxQueueDescriptor>(descriptor, info)
19  , m_SoftmaxLayer(memoryManager)
20 {
21  m_Data.ValidateInputsOutputs("ClSoftmaxFloatWorkload", 1, 1);
22 
23  arm_compute::ICLTensor& input = static_cast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
24  arm_compute::ICLTensor& output = static_cast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
25 
26  unsigned int aclAxis = ComputeSoftmaxAclAxis(m_Data.m_Parameters, info.m_InputTensorInfos[0]);
27  m_SoftmaxLayer.configure(&input, &output, m_Data.m_Parameters.m_Beta, aclAxis);
28 }
29 
31 {
32  ARMNN_SCOPED_PROFILING_EVENT_CL("ClSoftmaxFloatWorkload_Execute");
33  RunClFunction(m_SoftmaxLayer, CHECK_LOCATION());
34 }
35 
36 } //namespace armnn
ClSoftmaxFloatWorkload(const SoftmaxQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager)
#define ARMNN_SCOPED_PROFILING_EVENT_CL(name)
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
const QueueDescriptor m_Data
Definition: Workload.hpp:46
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Copyright (c) 2020 ARM Limited.
std::vector< TensorInfo > m_InputTensorInfos
#define CHECK_LOCATION()
Definition: Exceptions.hpp:192
unsigned int ComputeSoftmaxAclAxis(const SoftmaxDescriptor &softmaxDesc, const armnn::TensorInfo &tensor)
std::vector< ITensorHandle * > m_Outputs
Contains information about inputs and outputs to a layer.
std::vector< ITensorHandle * > m_Inputs