Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClQuantizeWorkload.hpp" |
| 7 | #include "ClWorkloadUtils.hpp" |
| 8 | |
| 9 | #include <aclCommon/ArmComputeUtils.hpp> |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
| 11 | |
| 12 | #include <backendsCommon/CpuTensorHandle.hpp> |
| 13 | |
| 14 | #include <cl/ClLayerSupport.hpp> |
| 15 | #include <cl/ClTensorHandle.hpp> |
| 16 | #include <cl/ClLayerSupport.hpp> |
| 17 | |
| 18 | namespace armnn |
| 19 | { |
| 20 | using namespace armcomputetensorutils; |
| 21 | |
| 22 | arm_compute::Status ClQuantizeWorkloadValidate(const TensorInfo& input, |
| 23 | const TensorInfo& output) |
| 24 | { |
| 25 | const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input); |
| 26 | const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output); |
| 27 | |
| 28 | return arm_compute::CLQuantizationLayer::validate(&aclInputInfo, |
| 29 | &aclOutputInfo); |
| 30 | } |
| 31 | |
| 32 | ClQuantizeWorkload::ClQuantizeWorkload(const QuantizeQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 33 | : BaseWorkload<QuantizeQueueDescriptor>(descriptor, info) |
| 34 | { |
Keith Davis | a856501 | 2020-02-14 12:22:40 +0000 | [diff] [blame] | 35 | m_Data.ValidateInputsOutputs("ClQuantizeWorkload", 1, 1); |
| 36 | |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 37 | arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 38 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 39 | |
| 40 | m_Layer.configure(&input, &output); |
| 41 | } |
| 42 | |
| 43 | void ClQuantizeWorkload::Execute() const |
| 44 | { |
| 45 | ARMNN_SCOPED_PROFILING_EVENT_CL("ClQuantizeWorkload_Execute"); |
| 46 | RunClFunction(m_Layer, CHECK_LOCATION()); |
| 47 | } |
| 48 | |
| 49 | } //namespace armnn |