1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5
6 #include "ClLogicalNotWorkload.hpp"
7
8 #include "ClWorkloadUtils.hpp"
9
10 #include <armnn/utility/PolymorphicDowncast.hpp>
11
12 #include <aclCommon/ArmComputeTensorUtils.hpp>
13
14 #include <cl/ClTensorHandle.hpp>
15
16 namespace armnn
17 {
18 using namespace armcomputetensorutils;
19
ClLogicalNotWorkloadValidate(const TensorInfo & input,const TensorInfo & output)20 arm_compute::Status ClLogicalNotWorkloadValidate(const TensorInfo& input,
21 const TensorInfo& output)
22 {
23 const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input);
24 const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output);
25
26 const arm_compute::Status aclStatus = arm_compute::CLLogicalNot::validate(&aclInputInfo,
27 &aclOutputInfo);
28 return aclStatus;
29 }
30
ClLogicalNotWorkload(const ElementwiseUnaryQueueDescriptor & descriptor,const WorkloadInfo & info,const arm_compute::CLCompileContext & clCompileContext)31 ClLogicalNotWorkload::ClLogicalNotWorkload(const ElementwiseUnaryQueueDescriptor& descriptor,
32 const WorkloadInfo& info,
33 const arm_compute::CLCompileContext& clCompileContext)
34 : ClBaseWorkload<ElementwiseUnaryQueueDescriptor>(descriptor, info)
35 {
36 // Report Profiling Details
37 ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClLogicalNotWorkload_Construct",
38 descriptor.m_Parameters,
39 info,
40 this->GetGuid());
41
42 m_Data.ValidateInputsOutputs("ClLogicalNotWorkload", 1, 1);
43
44 arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
45 arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
46
47 {
48 ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClLogicalNotWorkload_configure");
49 m_LogicalNotLayer.configure(clCompileContext, &input, &output);
50 }
51 }
52
Execute() const53 void ClLogicalNotWorkload::Execute() const
54 {
55 ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClLogicalNotWorkload_Execute", this->GetGuid());
56 m_LogicalNotLayer.run();
57 }
58
59 } // namespace armnn
60