ArmNN
 24.02
NeonInstanceNormalizationWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019,2021-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "NeonWorkloadUtils.hpp"
9 
13 
14 using namespace armnn::armcomputetensorutils;
15 
16 namespace armnn
17 {
18 
20  const TensorInfo& output,
21  const InstanceNormalizationDescriptor& descriptor)
22 {
23  const arm_compute::TensorInfo aclInputInfo = BuildArmComputeTensorInfo(input, descriptor.m_DataLayout);
24  const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(output, descriptor.m_DataLayout);
25 
26  return arm_compute::NEInstanceNormalizationLayer::validate(&aclInputInfo,
27  &aclOutputInfo,
28  descriptor.m_Gamma,
29  descriptor.m_Beta,
30  descriptor.m_Eps);
31 }
32 
34  const InstanceNormalizationQueueDescriptor& descriptor,
35  const WorkloadInfo& info)
37 {
38  // Report Profiling Details
39  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonInstanceNormalizationWorkload_Construct",
40  descriptor.m_Parameters,
41  info,
42  this->GetGuid());
43 
44  m_Data.ValidateInputsOutputs("NeonInstanceNormalizationWorkload", 1, 1);
45 
46  arm_compute::ITensor& input = static_cast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
47  arm_compute::ITensor& output = static_cast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
48 
49  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
50  input.info()->set_data_layout(aclDataLayout);
51  output.info()->set_data_layout(aclDataLayout);
52 
53  m_Layer.configure(&input,
54  &output,
55  descriptor.m_Parameters.m_Gamma,
56  descriptor.m_Parameters.m_Beta,
57  descriptor.m_Parameters.m_Eps);
58 };
59 
61 {
62  ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID("NeonInstanceNormalizationWorkload_Execute");
63  m_Layer.run();
64 }
65 
66 } // namespace armnn
armnn::InstanceNormalizationDescriptor::m_Beta
float m_Beta
Beta, the offset scalar value applied for the normalized tensor. Defaults to 1.0.
Definition: Descriptors.hpp:867
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::QueueDescriptor::ValidateInputsOutputs
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
Definition: WorkloadData.cpp:446
armnn::InstanceNormalizationDescriptor
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
Definition: Descriptors.hpp:847
armnn::NeonInstanceNormalizationWorkloadValidate
arm_compute::Status NeonInstanceNormalizationWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const InstanceNormalizationDescriptor &descriptor)
Definition: NeonInstanceNormalizationWorkload.cpp:19
armnn::TensorInfo
Definition: Tensor.hpp:152
NeonTensorHandle.hpp
armnn::IAclTensorHandle
Definition: ArmComputeTensorHandle.hpp:16
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::InstanceNormalizationQueueDescriptor
Definition: WorkloadData.hpp:353
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::InstanceNormalizationDescriptor::m_Gamma
float m_Gamma
Gamma, the scale scalar value applied for the normalized tensor. Defaults to 1.0.
Definition: Descriptors.hpp:865
armnn::NeonInstanceNormalizationWorkload::Execute
void Execute() const override
Definition: NeonInstanceNormalizationWorkload.cpp:60
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
ARMNN_REPORT_PROFILING_WORKLOAD_DESC
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
armnn::InstanceNormalizationDescriptor::m_DataLayout
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Definition: Descriptors.hpp:871
NeonInstanceNormalizationWorkload.hpp
TensorHandle.hpp
armnn::Status
Status
Definition: Types.hpp:42
armnn::BaseWorkload< InstanceNormalizationQueueDescriptor >::m_Data
InstanceNormalizationQueueDescriptor m_Data
Definition: Workload.hpp:89
NeonWorkloadUtils.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
ArmComputeTensorUtils.hpp
armnn::NeonInstanceNormalizationWorkload::NeonInstanceNormalizationWorkload
NeonInstanceNormalizationWorkload(const InstanceNormalizationQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: NeonInstanceNormalizationWorkload.cpp:33
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:32
armnn::NeonBaseWorkload
Definition: NeonBaseWorkload.hpp:13
armnn::InstanceNormalizationDescriptor::m_Eps
float m_Eps
Epsilon, small scalar value added to variance to avoid dividing by zero. Defaults to 1e-12f.
Definition: Descriptors.hpp:869
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26