Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "NeonDequantizeWorkload.hpp" |
| 7 | |
| 8 | #include "NeonWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 11 | #include <backendsCommon/CpuTensorHandle.hpp> |
| 12 | #include <neon/NeonTensorHandle.hpp> |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | |
| 17 | using namespace armcomputetensorutils; |
| 18 | |
| 19 | arm_compute::Status NeonDequantizeWorkloadValidate(const TensorInfo& input, |
| 20 | const TensorInfo& output) |
| 21 | { |
| 22 | const arm_compute::TensorInfo aclInput = BuildArmComputeTensorInfo(input); |
| 23 | const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output); |
| 24 | |
| 25 | return arm_compute::NEDequantizationLayer::validate(&aclInput, &aclOutput); |
| 26 | } |
| 27 | |
| 28 | NeonDequantizeWorkload::NeonDequantizeWorkload(const DequantizeQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 29 | : BaseWorkload<DequantizeQueueDescriptor>(descriptor, info) |
| 30 | { |
| 31 | m_Data.ValidateInputsOutputs("NeonDequantizeWorkload", 1, 1); |
| 32 | |
Derek Lamberti | c81855f | 2019-06-13 17:34:19 +0100 | [diff] [blame] | 33 | arm_compute::ITensor& input = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 34 | arm_compute::ITensor& output = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Narumol Prangnawarat | 01961a7 | 2019-05-30 16:47:12 +0100 | [diff] [blame] | 35 | |
| 36 | m_Layer.reset(new arm_compute::NEDequantizationLayer()); |
| 37 | m_Layer->configure(&input, &output); |
| 38 | m_Layer->prepare(); |
| 39 | } |
| 40 | |
| 41 | void NeonDequantizeWorkload::Execute() const |
| 42 | { |
| 43 | ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonDequantizeWorkload_Execute"); |
| 44 | m_Layer->run(); |
| 45 | } |
| 46 | |
| 47 | } //namespace armnn |
| 48 | |