42 auto layer = CloneBase<BatchNormalizationLayer>(graph,
m_Param,
GetName());
44 layer->
m_Mean =
m_Mean ? std::make_unique<ScopedCpuTensorHandle>(*m_Mean) :
nullptr;
45 layer->m_Variance =
m_Variance ? std::make_unique<ScopedCpuTensorHandle>(*m_Variance) :
nullptr;
46 layer->m_Beta =
m_Beta ? std::make_unique<ScopedCpuTensorHandle>(*m_Beta) :
nullptr;
47 layer->m_Gamma =
m_Gamma ? std::make_unique<ScopedCpuTensorHandle>(*m_Gamma) :
nullptr;
49 return std::move(layer);
85 std::vector<armnn::ConstTensor> constTensors { {
m_Mean->GetTensorInfo(),
m_Mean->Map(
true)},
virtual std::unique_ptr< IWorkload > CreateBatchNormalization(const BatchNormalizationQueueDescriptor &descriptor, const WorkloadInfo &info) const
const ConstCpuTensorHandle * m_Gamma
const ConstCpuTensorHandle * m_Beta
This layer represents a batch normalization operation.
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const override
Makes a workload for the BatchNormalization type.
BatchNormalizationDescriptor m_Param
The parameters for the layer (not including tensor-valued weights etc.).
const BatchNormalizationDescriptor & GetParameters() const
BatchNormalizationLayer * Clone(Graph &graph) const override
Creates a dynamically-allocated copy of this layer.
const TensorShape & GetShape() const
void ExecuteStrategy(IStrategy &strategy) const override
Apply a visitor to this layer.
std::vector< TensorShape > InferOutputShapes(const std::vector< TensorShape > &inputShapes) const override
Infer the shape of the output(s) based on the provided input shape(s)
virtual void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0)=0
const ConstCpuTensorHandle * m_Mean
std::unique_ptr< ScopedCpuTensorHandle > m_Gamma
A unique pointer to store Gamma values.
const ConstCpuTensorHandle * m_Variance
std::unique_ptr< ScopedCpuTensorHandle > m_Variance
A unique pointer to store Variance values.
void VerifyShapeInferenceType(const TensorShape &outputShape, ShapeInferenceMethod shapeInferenceMethod)
Copyright (c) 2021 ARM Limited and Contributors.
void Accept(ILayerVisitor &visitor) const override
Apply a visitor to this layer.
virtual void VisitBatchNormalizationLayer(const IConnectableLayer *layer, const BatchNormalizationDescriptor &desc, const ConstTensor &mean, const ConstTensor &variance, const ConstTensor &beta, const ConstTensor &gamma, const char *name=nullptr)=0
Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) functio...
void ValidateAndCopyShape(const TensorShape &outputShape, const TensorShape &inferredShape, const ShapeInferenceMethod shapeInferenceMethod, const std::string &layerName, const unsigned int outputSlotIndex=0)
std::unique_ptr< ScopedCpuTensorHandle > m_Beta
A unique pointer to store Beta values.
void VerifyLayerConnections(unsigned int expectedConnections, const CheckLocation &location) const
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
#define ARMNN_ASSERT_MSG(COND, MSG)
std::unique_ptr< ScopedCpuTensorHandle > m_Mean
A unique pointer to store Mean values.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
#define ARMNN_ASSERT(COND)
void ValidateTensorShapesFromInputs() override
Check if the input tensor shape(s) will lead to a valid configuration of BatchNormalizationLayer.
void SetAdditionalInfo(QueueDescriptor &descriptor) const
ConstantTensors GetConstantTensorsByRef() override
Retrieve the handles to the constant values stored by the layer.
WorkloadInfo PrepInfoAndDesc(QueueDescriptor &descriptor) const
Helper function to reduce duplication in *LayerCreateWorkload.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
virtual const TensorInfo & GetTensorInfo() const =0
const char * GetName() const override
Returns the name of the layer.
std::vector< std::reference_wrapper< std::unique_ptr< ScopedCpuTensorHandle > >> ConstantTensors
const TensorInfo & GetTensorInfo() const override
BatchNormalizationLayer(const BatchNormalizationDescriptor ¶m, const char *name)
Constructor to create a BatchNormalizationLayer.
ShapeInferenceMethod m_ShapeInferenceMethod
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...