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 | |
James Conroy | 1f58f03 | 2021-04-27 17:13:27 +0100 | [diff] [blame] | 12 | #include <backendsCommon/TensorHandle.hpp> |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 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 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 32 | ClQuantizeWorkload::ClQuantizeWorkload(const QuantizeQueueDescriptor& descriptor, |
| 33 | const WorkloadInfo& info, |
| 34 | const arm_compute::CLCompileContext& clCompileContext) |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 35 | : BaseWorkload<QuantizeQueueDescriptor>(descriptor, info) |
| 36 | { |
Keith Davis | a856501 | 2020-02-14 12:22:40 +0000 | [diff] [blame] | 37 | m_Data.ValidateInputsOutputs("ClQuantizeWorkload", 1, 1); |
| 38 | |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 39 | arm_compute::ICLTensor& input = static_cast<IClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 40 | arm_compute::ICLTensor& output = static_cast<IClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
| 41 | |
Sadik Armagan | e944475 | 2020-12-02 11:28:58 +0000 | [diff] [blame] | 42 | m_Layer.configure(clCompileContext, &input, &output); |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | void ClQuantizeWorkload::Execute() const |
| 46 | { |
Keith Davis | bcd860a | 2021-08-05 14:20:33 +0100 | [diff] [blame] | 47 | ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClQuantizeWorkload_Execute", this->GetGuid()); |
Sadik Armagan | 20ec249 | 2019-05-31 09:09:44 +0100 | [diff] [blame] | 48 | RunClFunction(m_Layer, CHECK_LOCATION()); |
| 49 | } |
| 50 | |
| 51 | } //namespace armnn |