blob: 92e5139c1a495b8e2b94d075b67a4469f6b9f4b6 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa014fcda012018-03-09 14:13:49 +00004//
5
arovir019e53a352018-08-31 15:26:35 +01006#include "NeonSoftmaxFloatWorkload.hpp"
telsoa014fcda012018-03-09 14:13:49 +00007
8namespace armnn
9{
surmeh013537c2c2018-05-18 16:31:43 +010010
arovir019e53a352018-08-31 15:26:35 +010011NeonSoftmaxFloatWorkload::NeonSoftmaxFloatWorkload(const SoftmaxQueueDescriptor& descriptor,
surmeh013537c2c2018-05-18 16:31:43 +010012 const WorkloadInfo& info, std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
telsoa01c577f2c2018-08-31 09:22:23 +010013 : FloatWorkload<SoftmaxQueueDescriptor>(descriptor, info)
surmeh013537c2c2018-05-18 16:31:43 +010014 , m_SoftmaxLayer(memoryManager)
telsoa014fcda012018-03-09 14:13:49 +000015{
arovir019e53a352018-08-31 15:26:35 +010016 m_Data.ValidateInputsOutputs("NeonSoftmaxFloatWorkload", 1, 1);
telsoa014fcda012018-03-09 14:13:49 +000017
telsoa01c577f2c2018-08-31 09:22:23 +010018 // The ArmCompute softmax layer uses 2D input/output tensors, so flatten the first three dimensions.
telsoa014fcda012018-03-09 14:13:49 +000019 arm_compute::ITensor& input = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
20 arm_compute::ITensor& output = boost::polymorphic_downcast<INeonTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
21
22 m_SoftmaxLayer.configure(&input, &output, m_Data.m_Parameters.m_Beta);
23}
24
arovir019e53a352018-08-31 15:26:35 +010025void NeonSoftmaxFloatWorkload::Execute() const
telsoa014fcda012018-03-09 14:13:49 +000026{
arovir019e53a352018-08-31 15:26:35 +010027 ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonSoftmaxFloatWorkload_Execute");
telsoa014fcda012018-03-09 14:13:49 +000028 m_SoftmaxLayer.run();
29}
surmeh013537c2c2018-05-18 16:31:43 +010030
telsoa014fcda012018-03-09 14:13:49 +000031} //namespace armnn
32