Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "ClNegWorkload.hpp" |
| 7 | |
| 8 | #include "ClWorkloadUtils.hpp" |
| 9 | |
| 10 | #include <aclCommon/ArmComputeTensorUtils.hpp> |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 11 | #include <armnn/utility/PolymorphicDowncast.hpp> |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 12 | |
| 13 | #include <cl/ClTensorHandle.hpp> |
| 14 | |
| 15 | #include <boost/cast.hpp> |
| 16 | |
| 17 | namespace armnn |
| 18 | { |
| 19 | |
| 20 | arm_compute::Status ClNegWorkloadValidate(const TensorInfo& input, const TensorInfo& output) |
| 21 | { |
| 22 | const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 23 | const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 24 | |
| 25 | return arm_compute::CLNegLayer::validate(&aclInput, &aclOutput); |
| 26 | } |
| 27 | |
| 28 | ClNegWorkload::ClNegWorkload(const ElementwiseUnaryQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 29 | : BaseWorkload<ElementwiseUnaryQueueDescriptor>(descriptor, info) |
| 30 | { |
| 31 | m_Data.ValidateInputsOutputs("ClNegWorkload", 1, 1); |
| 32 | |
Jan Eilers | bb446e5 | 2020-04-02 13:56:54 +0100 | [diff] [blame] | 33 | arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor(); |
| 34 | arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor(); |
Sadik Armagan | ac47210 | 2020-03-24 09:54:36 +0000 | [diff] [blame] | 35 | |
| 36 | m_NegLayer.configure(&input, &output); |
| 37 | } |
| 38 | |
| 39 | void ClNegWorkload::Execute() const |
| 40 | { |
| 41 | ARMNN_SCOPED_PROFILING_EVENT_CL("ClNegWorkload_Execute"); |
| 42 | RunClFunction(m_NegLayer, CHECK_LOCATION()); |
| 43 | } |
| 44 | |
| 45 | } // namespace armnn |