Nikhil Raj | 68c2c90 | 2019-09-19 11:21:11 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefArgMinMaxWorkload.hpp" |
| 7 | |
| 8 | #include "ArgMinMax.hpp" |
| 9 | #include "RefWorkloadUtils.hpp" |
| 10 | #include "Decoders.hpp" |
| 11 | #include "Encoders.hpp" |
| 12 | #include "Profiling.hpp" |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | RefArgMinMaxWorkload::RefArgMinMaxWorkload( |
| 17 | const ArgMinMaxQueueDescriptor& descriptor, |
| 18 | const WorkloadInfo& info) |
| 19 | : BaseWorkload<ArgMinMaxQueueDescriptor>(descriptor, info) {} |
| 20 | |
| 21 | void RefArgMinMaxWorkload::Execute() const |
| 22 | { |
| 23 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefArgMinMaxWorkload_Execute"); |
| 24 | |
| 25 | const TensorInfo &inputTensorInfo = GetTensorInfo(m_Data.m_Inputs[0]); |
| 26 | |
| 27 | std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, m_Data.m_Inputs[0]->Map()); |
| 28 | Decoder<float> &decoder = *decoderPtr; |
| 29 | |
| 30 | const TensorInfo &outputTensorInfo = GetTensorInfo(m_Data.m_Outputs[0]); |
| 31 | |
Inki Dae | d4619e2 | 2020-09-10 15:33:54 +0900 | [diff] [blame] | 32 | if (m_Data.m_Parameters.m_Output_Type == armnn::DataType::Signed32) { |
| 33 | int32_t *output = GetOutputTensorData<int32_t>(0, m_Data); |
| 34 | ArgMinMax(decoder, output, inputTensorInfo, outputTensorInfo, m_Data.m_Parameters.m_Function, |
| 35 | m_Data.m_Parameters.m_Axis); |
| 36 | } else { |
| 37 | int64_t *output = GetOutputTensorData<int64_t>(0, m_Data); |
| 38 | ArgMinMax(decoder, output, inputTensorInfo, outputTensorInfo, m_Data.m_Parameters.m_Function, |
| 39 | m_Data.m_Parameters.m_Axis); |
| 40 | } |
Nikhil Raj | 68c2c90 | 2019-09-19 11:21:11 +0100 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | } //namespace armnn |