ArmNN
 24.08
NeonSqrtWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "NeonSqrtWorkload.hpp"
7 
8 #include "NeonWorkloadUtils.hpp"
9 
14 
15 namespace armnn
16 {
17 
19 {
20  const arm_compute::TensorInfo aclInput = armcomputetensorutils::BuildArmComputeTensorInfo(input);
21  const arm_compute::TensorInfo aclOutput = armcomputetensorutils::BuildArmComputeTensorInfo(output);
22 
23  ActivationDescriptor descriptor;
25  const arm_compute::ActivationLayerInfo activationLayerInfo =
27 
28  return arm_compute::NEActivationLayer::validate(&aclInput, &aclOutput, activationLayerInfo);
29 }
30 
33 {
35  {
36  throw InvalidArgumentException("NeonSqrtWorkload: The descriptor does not indicate a Sqrt operation.");
37  }
38 
39  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonSqrtWorkload_Construct",
40  descriptor.m_Parameters,
41  info,
42  this->GetGuid());
43 
44  m_Data.ValidateInputsOutputs("NeonSqrtWorkload", 1, 1);
45 
46  ActivationDescriptor activationDescriptor;
47  activationDescriptor.m_Function = ActivationFunction::Sqrt;
48  const arm_compute::ActivationLayerInfo activationLayerInfo =
50 
51  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
52  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
53 
54  m_SqrtLayer.configure(&input, &output, activationLayerInfo);
55 }
56 
58 {
59  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonSqrtWorkload_Execute");
60  m_SqrtLayer.run();
61 }
62 
63 } // namespace armnn
armnn::ActivationDescriptor
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:36
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:447
armnn::ActivationFunction::Sqrt
@ Sqrt
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::NeonSqrtWorkload::Execute
virtual void Execute() const override
Definition: NeonSqrtWorkload.cpp:57
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::UnaryOperation::Sqrt
@ Sqrt
armnn::NeonSqrtWorkloadValidate
arm_compute::Status NeonSqrtWorkloadValidate(const TensorInfo &input, const TensorInfo &output)
Definition: NeonSqrtWorkload.cpp:18
armnn::ElementwiseUnaryQueueDescriptor
Definition: WorkloadData.hpp:676
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
PolymorphicDowncast.hpp
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::ActivationDescriptor::m_Function
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu,...
Definition: Descriptors.hpp:59
ArmComputeUtils.hpp
armnn::ConvertActivationDescriptorToAclActivationLayerInfo
arm_compute::ActivationLayerInfo ConvertActivationDescriptorToAclActivationLayerInfo(const ActivationDescriptor &actDesc)
Definition: ArmComputeUtils.hpp:87
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
ArmComputeTensorHandle.hpp
armnn::ElementwiseUnaryDescriptor::m_Operation
UnaryOperation m_Operation
Specifies the elementwiseUnary operation to execute.
Definition: Descriptors.hpp:145
ARMNN_REPORT_PROFILING_WORKLOAD_DESC
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
armnn::Status
Status
Definition: Types.hpp:42
armnn::BaseWorkload< ElementwiseUnaryQueueDescriptor >::m_Data
ElementwiseUnaryQueueDescriptor m_Data
Definition: Workload.hpp:89
NeonWorkloadUtils.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
NeonSqrtWorkload.hpp
armnn::NeonSqrtWorkload::NeonSqrtWorkload
NeonSqrtWorkload(const ElementwiseUnaryQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonSqrtWorkload.cpp:31
ArmComputeTensorUtils.hpp
ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: NeonWorkloadUtils.hpp:33
armnn::NeonBaseWorkload
Definition: NeonBaseWorkload.hpp:13
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26