24.02
|
Go to the documentation of this file.
31 unsigned int inputBatches = inputShape[0];
32 unsigned int inputHeight = inputShape[dataLayout.
GetHeightIndex()];
33 unsigned int inputWidth = inputShape[dataLayout.
GetWidthIndex()];
36 for (
unsigned int c = 0; c < inputChannels; c++)
42 float mean = meanDecoder.
Get();
43 float var = varianceDecoder.
Get();
44 float beta = betaDecoder.
Get();
45 float gamma = gammaDecoder.
Get();
48 float add = beta - mult * mean;
50 for (
unsigned int n = 0; n < inputBatches; n++)
52 for (
unsigned int h = 0; h < inputHeight; h++)
54 for (
unsigned int w = 0; w < inputWidth; w++)
56 unsigned int index = dataLayout.
GetIndex(inputShape, n, c, h, w);
59 outputEncoder.
Set(mult * inputDecoder.
Get() + add);
virtual void Set(IType right)=0
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Provides access to the appropriate indexes for Channels, Height and Width based on DataLayout.
unsigned int GetHeightIndex() const
void BatchNormImpl(const BatchNormalizationQueueDescriptor &data, Decoder< float > &meanDecoder, Decoder< float > &varianceDecoder, Decoder< float > &betaDecoder, Decoder< float > &gammaDecoder, Decoder< float > &inputDecoder, Encoder< float > &outputEncoder)
LayerDescriptor m_Parameters
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
unsigned int GetWidthIndex() const
virtual IType Get() const =0
const TensorShape & GetShape() const
Copyright (c) 2021 ARM Limited and Contributors.
unsigned int GetChannelsIndex() const
unsigned int GetIndex(const armnn::TensorShape &shape, unsigned int batchIndex, unsigned int channelIndex, unsigned int heightIndex, unsigned int widthIndex) const
float m_Eps
Value to add to the variance. Used to avoid dividing by zero.
std::vector< ITensorHandle * > m_Inputs