narpra01 | 1e4c31d | 2018-09-28 11:07:51 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefMeanUint8Workload.hpp" |
| 7 | |
| 8 | #include "Mean.hpp" |
| 9 | #include "RefWorkloadUtils.hpp" |
| 10 | |
| 11 | #include "Profiling.hpp" |
| 12 | |
| 13 | #include <vector> |
| 14 | |
| 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | RefMeanUint8Workload::RefMeanUint8Workload(const MeanQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 19 | :Uint8Workload<MeanQueueDescriptor>(descriptor, info) {} |
| 20 | |
| 21 | |
| 22 | void RefMeanUint8Workload::Execute() const |
| 23 | { |
| 24 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefMeanUint8Workload_Execute"); |
| 25 | |
| 26 | const TensorInfo& inputInfo = GetTensorInfo(m_Data.m_Inputs[0]); |
| 27 | const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]); |
| 28 | |
| 29 | auto dequant = Dequantize(GetInputTensorDataU8(0, m_Data), inputInfo); |
| 30 | |
| 31 | std::vector<float> results(outputInfo.GetNumElements()); |
| 32 | |
| 33 | Mean(inputInfo, outputInfo, m_Data.m_Parameters.m_Axis, dequant.data(), results.data()); |
| 34 | |
| 35 | Quantize(GetOutputTensorDataU8(0, m_Data), results.data(), outputInfo); |
| 36 | } |
| 37 | |
| 38 | } //namespace armnn |
| 39 | |