13#include <arm_compute/runtime/NEON/functions/NENormalizationLayer.h>
15using namespace armnn::armcomputetensorutils;
29 if (reasonIfUnsupported)
31 reasonIfUnsupported.
value() =
"Unsupported normalisation method type, only LocalBrightness is supported";
37 if (reasonIfUnsupported)
39 reasonIfUnsupported.
value() =
"Normalization size must be an odd number.";
53 const arm_compute::TensorInfo aclInput = BuildArmComputeTensorInfo(input, descriptor.
m_DataLayout);
54 const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output, descriptor.
m_DataLayout);
56 arm_compute::NormalizationLayerInfo normalizationInfo = BuildArmComputeNormalizationLayerInfo(descriptor);
58 return arm_compute::NENormalizationLayer::validate(&aclInput, &aclOutput, normalizationInfo);
72 m_Data.ValidateInputsOutputs(
"NeonNormalizationFloatWorkload", 1, 1);
73 std::string reasonIfUnsupported;
80 if (
info.m_InputTensorInfos[0].GetShape()[1] !=
info.m_OutputTensorInfos[0].GetShape()[1]
81 ||
info.m_InputTensorInfos[0].GetShape()[0] !=
info.m_OutputTensorInfos[0].GetShape()[0]
82 ||
info.m_InputTensorInfos[0].GetShape()[3] !=
info.m_OutputTensorInfos[0].GetShape()[3]
83 ||
info.m_InputTensorInfos[0].GetShape()[2] !=
info.m_OutputTensorInfos[0].GetShape()[2])
90 arm_compute::DataLayout aclDataLayout = ConvertDataLayout(
m_Data.m_Parameters.m_DataLayout);
91 input.info()->set_data_layout(aclDataLayout);
92 output.info()->set_data_layout(aclDataLayout);
94 const arm_compute::NormType normType =
96 arm_compute::NormalizationLayerInfo normalizationInfo(normType,
97 m_Data.m_Parameters.m_NormSize,
98 m_Data.m_Parameters.m_Alpha,
99 m_Data.m_Parameters.m_Beta,
102 auto layer = std::make_unique<arm_compute::NENormalizationLayer>(memoryManager);
103 layer->configure(&input, &output, normalizationInfo);
104 m_NormalizationLayer.reset(layer.release());
110 m_NormalizationLayer->run();
116 this->
m_Data.m_Inputs[slot] = tensorHandle;
124 this->
m_Data.m_Inputs[slot] = backupHandle;
133 this->
m_Data.m_Inputs[slot] = tensorHandle;
141 this->
m_Data.m_Inputs[slot] = backupHandle;
146void NeonNormalizationFloatWorkload::Reconfigure()
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
NeonNormalizationFloatWorkload(const NormalizationQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager)
void ReplaceInputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
void ReplaceOutputTensorHandle(ITensorHandle *tensorHandle, unsigned int slot) override
virtual void Execute() const override
Copyright (c) 2021 ARM Limited and Contributors.
arm_compute::Status NeonNormalizationWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const NormalizationDescriptor &descriptor)
arm_compute::NormType ConvertNormalizationAlgorithmChannelToAclNormType(NormalizationAlgorithmChannel channelType)
DestType PolymorphicDowncast(SourceType *value)
Polymorphic downcast for build in pointers only.
TypedWorkload< QueueDescriptor, armnn::DataType::Float16, armnn::DataType::Float32 > FloatWorkload
@ LocalBrightness
Krichevsky 2012: Local Brightness Normalization.
std::shared_ptr< arm_compute::MemoryManagerOnDemand > ACLMemManagerOnDemand
A NormalizationDescriptor for the NormalizationLayer.
NormalizationAlgorithmMethod m_NormMethodType
Normalization method algorithm to use (LocalBrightness, LocalContrast).
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_NormSize
Depth radius value.
LayerDescriptor m_Parameters
Contains information about TensorInfos of a layer.