17 #include <arm_compute/runtime/NEON/functions/NEBatchNormalizationLayer.h>
21 using namespace armcomputetensorutils;
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);
47 activationDescriptor);
49 return arm_compute::NEBatchNormalizationLayer::validate(&aclInputInfo,
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();
75 input.info()->set_data_layout(aclDataLayout);
76 output.info()->set_data_layout(aclDataLayout);
78 m_Mean = std::make_unique<arm_compute::Tensor>();
81 m_Variance = std::make_unique<arm_compute::Tensor>();
84 m_Gamma = std::make_unique<arm_compute::Tensor>();
87 m_Beta = std::make_unique<arm_compute::Tensor>();
92 auto layer = std::make_unique<arm_compute::NEBatchNormalizationLayer>();
93 layer->configure(&input,
101 m_Layer.reset(layer.release());
120 void NeonBatchNormalizationWorkload::FreeUnusedTensors()
122 FreeTensorIfUnused(m_Mean);
123 FreeTensorIfUnused(m_Variance);
124 FreeTensorIfUnused(m_Gamma);
125 FreeTensorIfUnused(m_Beta);