From ae050524109f1ce827962665436ef7430f2ac479 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Wed, 22 Mar 2023 16:48:58 +0000 Subject: IVGCVSW-7255 Update Doxygen Documentation and publish on GitHub. * Updating Doxygen documentation for 23.02 release. Signed-off-by: David Monahan Change-Id: I545574ff7664b4595d2fe6a91a3c35d2ad55df82 --- ..._batch_normalization_workload_8cpp_source.xhtml | 281 +++++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100644 latest/_neon_batch_normalization_workload_8cpp_source.xhtml (limited to 'latest/_neon_batch_normalization_workload_8cpp_source.xhtml') diff --git a/latest/_neon_batch_normalization_workload_8cpp_source.xhtml b/latest/_neon_batch_normalization_workload_8cpp_source.xhtml new file mode 100644 index 0000000000..36eec6bdb5 --- /dev/null +++ b/latest/_neon_batch_normalization_workload_8cpp_source.xhtml @@ -0,0 +1,281 @@ + + + + + + + + + + + + + +ArmNN: src/backends/neon/workloads/NeonBatchNormalizationWorkload.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
NeonBatchNormalizationWorkload.cpp
+
+
+Go to the documentation of this file.
1 //
+
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+ +
7 
+
8 #include "NeonWorkloadUtils.hpp"
+
9 
+ + +
12 
+ +
14 
+ +
16 
+
17 #include <arm_compute/runtime/NEON/functions/NEBatchNormalizationLayer.h>
+
18 
+
19 namespace armnn
+
20 {
+
21 using namespace armcomputetensorutils;
+
22 
+
23 
+ +
25  const TensorInfo& output,
+
26  const TensorInfo& mean,
+
27  const TensorInfo& var,
+
28  const TensorInfo& beta,
+
29  const TensorInfo& gamma,
+
30  const BatchNormalizationDescriptor& descriptor,
+
31  const ActivationDescriptor* activationDescriptor)
+
32 {
+
33  const arm_compute::TensorInfo aclInputInfo =
+
34  armcomputetensorutils::BuildArmComputeTensorInfo(input, descriptor.m_DataLayout);
+
35  const arm_compute::TensorInfo aclOutputInfo =
+
36  armcomputetensorutils::BuildArmComputeTensorInfo(output, descriptor.m_DataLayout);
+
37  const arm_compute::TensorInfo aclMeanInfo =
+
38  armcomputetensorutils::BuildArmComputeTensorInfo(mean, descriptor.m_DataLayout);
+
39  const arm_compute::TensorInfo aclVarInfo =
+
40  armcomputetensorutils::BuildArmComputeTensorInfo(var, descriptor.m_DataLayout);
+
41  const arm_compute::TensorInfo aclBetaInfo =
+
42  armcomputetensorutils::BuildArmComputeTensorInfo(beta, descriptor.m_DataLayout);
+
43  const arm_compute::TensorInfo aclGammaInfo =
+
44  armcomputetensorutils::BuildArmComputeTensorInfo(gamma, descriptor.m_DataLayout);
+
45 
+
46  const arm_compute::ActivationLayerInfo activationInfo = ConvertActivationDescriptorToAclActivationLayerInfo(
+
47  activationDescriptor);
+
48 
+
49  return arm_compute::NEBatchNormalizationLayer::validate(&aclInputInfo,
+
50  &aclOutputInfo,
+
51  &aclMeanInfo,
+
52  &aclVarInfo,
+
53  &aclBetaInfo,
+
54  &aclGammaInfo,
+
55  descriptor.m_Eps,
+
56  activationInfo);
+
57 }
+
58 
+ +
60  const BatchNormalizationQueueDescriptor& descriptor, const WorkloadInfo& info)
+ +
62 {
+
63  // Report Profiling Details
+
64  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonBatchNormalizationWorkload_Construct",
+
65  descriptor.m_Parameters,
+
66  info,
+
67  this->GetGuid());
+
68 
+
69  m_Data.ValidateInputsOutputs("NeonBatchNormalizationWorkload", 1, 1);
+
70 
+
71  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
+
72  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
+
73 
+
74  arm_compute::DataLayout aclDataLayout = ConvertDataLayout(m_Data.m_Parameters.m_DataLayout);
+
75  input.info()->set_data_layout(aclDataLayout);
+
76  output.info()->set_data_layout(aclDataLayout);
+
77 
+
78  m_Mean = std::make_unique<arm_compute::Tensor>();
+
79  BuildArmComputeTensor(*m_Mean, m_Data.m_Mean->GetTensorInfo());
+
80 
+
81  m_Variance = std::make_unique<arm_compute::Tensor>();
+
82  BuildArmComputeTensor(*m_Variance, m_Data.m_Variance->GetTensorInfo());
+
83 
+
84  m_Gamma = std::make_unique<arm_compute::Tensor>();
+
85  BuildArmComputeTensor(*m_Gamma, m_Data.m_Gamma->GetTensorInfo());
+
86 
+
87  m_Beta = std::make_unique<arm_compute::Tensor>();
+
88  BuildArmComputeTensor(*m_Beta, m_Data.m_Beta->GetTensorInfo());
+
89 
+
90  const arm_compute::ActivationLayerInfo activationInfo = ConvertAdditionalInfoToAclActivationLayerInfo(descriptor);
+
91 
+
92  auto layer = std::make_unique<arm_compute::NEBatchNormalizationLayer>();
+
93  layer->configure(&input,
+
94  &output,
+
95  m_Mean.get(),
+
96  m_Variance.get(),
+
97  m_Beta.get(),
+
98  m_Gamma.get(),
+ +
100  activationInfo);
+
101  m_Layer.reset(layer.release());
+
102 
+ + + + +
107 
+
108  // Force Compute Library to perform the necessary copying and reshaping, after which
+
109  // delete all the input tensors that will no longer be needed
+
110  m_Layer->prepare();
+
111  FreeUnusedTensors();
+
112 }
+
113 
+ +
115 {
+
116  ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonBatchNormalizationWorkload_Execute", this->GetGuid());
+
117  m_Layer->run();
+
118 }
+
119 
+
120 void NeonBatchNormalizationWorkload::FreeUnusedTensors()
+
121 {
+
122  FreeTensorIfUnused(m_Mean);
+
123  FreeTensorIfUnused(m_Variance);
+
124  FreeTensorIfUnused(m_Gamma);
+
125  FreeTensorIfUnused(m_Beta);
+
126 }
+
127 
+
128 } //namespace armnn
+
+
+
const ConstTensorHandle * m_Variance
+
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:61
+
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
+
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
+
DataLayout
Definition: Types.hpp:62
+ +
arm_compute::ActivationLayerInfo ConvertActivationDescriptorToAclActivationLayerInfo(const ActivationDescriptor &actDesc)
+
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:36
+ + + +
Copyright (c) 2021 ARM Limited and Contributors.
+
void InitializeArmComputeTensorData(arm_compute::Tensor &tensor, TensorInfo tensorInfo, const ITensorHandle *handle)
+
NeonBatchNormalizationWorkload(const BatchNormalizationQueueDescriptor &descriptor, const WorkloadInfo &info)
+ + + +
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID(name, guid)
+
arm_compute::Status NeonBatchNormalizationValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &mean, const TensorInfo &var, const TensorInfo &beta, const TensorInfo &gamma, const BatchNormalizationDescriptor &descriptor, const ActivationDescriptor *activationDescriptor)
+ + + + +
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
+ +
Status
Definition: Types.hpp:42
+
const TensorInfo & GetTensorInfo() const
+
arm_compute::ActivationLayerInfo ConvertAdditionalInfoToAclActivationLayerInfo(const QueueDescriptor &queueDescriptor)
+
Contains information about TensorInfos of a layer.
+ +
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
+
std::vector< ITensorHandle * > m_Outputs
+
float m_Eps
Value to add to the variance. Used to avoid dividing by zero.
+ +
std::vector< ITensorHandle * > m_Inputs
+ + + + + + -- cgit v1.2.1