blob: 17114ec83aa25128d03883ab058b4057398cc770 [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
6#include "RefSoftmaxUint8Workload.hpp"
7
8#include "RefWorkloadUtils.hpp"
9#include "Softmax.hpp"
10
11#include "Profiling.hpp"
12
13#include <vector>
14
15namespace armnn
16{
17
18void RefSoftmaxUint8Workload::Execute() const
19{
20 ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefSoftmaxUint8Workload_Execute");
21
22 const TensorInfo& tensorInfo = GetTensorInfo(m_Data.m_Inputs[0]);
23
24 auto dequant = Dequantize(GetInputTensorDataU8(0, m_Data), tensorInfo);
25
26 std::vector<float> results(tensorInfo.GetNumElements());
27
28 Softmax(dequant.data(),
29 results.data(),
30 tensorInfo,
31 m_Data.m_Parameters.m_Beta);
32
33 Quantize(GetOutputTensorDataU8(0, m_Data), results.data(), GetTensorInfo(m_Data.m_Outputs[0]));
34}
35
36} //namespace armnn