ArmNN
 22.08
ClSqrtWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ClSqrtWorkload.hpp"
7 
8 #include "ClWorkloadUtils.hpp"
9 
13 
14 #include <cl/ClTensorHandle.hpp>
15 
16 namespace armnn
17 {
18 
20 {
21  const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
22  const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
23 
24  ActivationDescriptor descriptor;
26  const arm_compute::ActivationLayerInfo activationLayerInfo =
28 
29  return arm_compute::CLActivationLayer::validate(&aclInput, &aclOutput, activationLayerInfo);
30 }
31 
33  const WorkloadInfo& info,
34  const arm_compute::CLCompileContext& clCompileContext)
36 {
38 
39  // Report Profiling Details
40  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("ClSqrtWorkload_Construct",
41  descriptor.m_Parameters,
42  info,
43  this->GetGuid());
44 
45  m_Data.ValidateInputsOutputs("ClSqrtWorkload", 1, 1);
46 
47  ActivationDescriptor activationDescriptor;
48  activationDescriptor.m_Function = ActivationFunction::Sqrt;
49  const arm_compute::ActivationLayerInfo activationLayerInfo =
51 
52  arm_compute::ICLTensor& input = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
53  arm_compute::ICLTensor& output = PolymorphicDowncast<ClTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
54 
55  {
56  ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "ClSqrtWorkload_configure");
57  m_SqrtLayer.configure(clCompileContext, &input, &output, activationLayerInfo);
58  }
59 }
60 
62 {
63  ARMNN_SCOPED_PROFILING_EVENT_CL_GUID("ClSqrtWorkload_Execute", this->GetGuid());
64  RunClFunction(m_SqrtLayer, CHECK_LOCATION());
65 }
66 
67 } // namespace armnn
#define ARMNN_SCOPED_PROFILING_EVENT_CL_GUID(name, guid)
UnaryOperation m_Operation
Specifies the elementwiseUnary operation to execute.
void RunClFunction(arm_compute::IFunction &function, const CheckLocation &location)
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:61
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Copyright (c) 2021 ARM Limited and Contributors.
arm_compute::Status ClSqrtWorkloadValidate(const TensorInfo &input, const TensorInfo &output)
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
ClSqrtWorkload(const ElementwiseUnaryQueueDescriptor &descriptor, const WorkloadInfo &info, const arm_compute::CLCompileContext &clCompileContext)
Status
enumeration
Definition: Types.hpp:42
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:36
#define CHECK_LOCATION()
Definition: Exceptions.hpp:203
virtual void Execute() const override
std::vector< ITensorHandle * > m_Outputs
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
Contains information about TensorInfos of a layer.
std::vector< ITensorHandle * > m_Inputs
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square, Elu).
Definition: Descriptors.hpp:59
arm_compute::ActivationLayerInfo ConvertActivationDescriptorToAclActivationLayerInfo(const ActivationDescriptor &actDesc)