Sadik Armagan | 0c3ea5b | 2021-02-03 09:29:30 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Samsung Electronics Co Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefReduceWorkload.hpp" |
| 7 | |
| 8 | #include "Reduce.hpp" |
| 9 | #include "RefWorkloadUtils.hpp" |
| 10 | #include "BaseIterator.hpp" |
| 11 | #include "Profiling.hpp" |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | RefReduceWorkload::RefReduceWorkload( |
| 17 | const ReduceQueueDescriptor& descriptor, |
| 18 | const WorkloadInfo& info) |
| 19 | : BaseWorkload<ReduceQueueDescriptor>(descriptor, info) {} |
| 20 | |
| 21 | void RefReduceWorkload::Execute() const |
| 22 | { |
| 23 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefReduceWorkload_Execute"); |
| 24 | |
| 25 | const TensorInfo& inputInfo = GetTensorInfo(m_Data.m_Inputs[0]); |
| 26 | const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]); |
| 27 | |
| 28 | std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputInfo, m_Data.m_Inputs[0]->Map()); |
| 29 | Decoder<float>& decoder = *decoderPtr; |
| 30 | |
| 31 | std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputInfo, m_Data.m_Outputs[0]->Map()); |
| 32 | Encoder<float>& encoder = *encoderPtr; |
| 33 | |
| 34 | Reduce(inputInfo, |
| 35 | outputInfo, |
| 36 | decoder, |
| 37 | encoder, |
| 38 | m_Data.m_Parameters.m_vAxis, |
| 39 | m_Data.m_Parameters.m_ReduceOperation); |
| 40 | } |
| 41 | |
| 42 | } //namespace armnn |