Compute Library
 22.05
BatchNormalizationLayer Class Referencefinal

Batchnormalization Layer. More...

#include <Layers.h>

Collaboration diagram for BatchNormalizationLayer:
[legend]

Public Member Functions

 BatchNormalizationLayer (ITensorAccessorUPtr mean, ITensorAccessorUPtr var, ITensorAccessorUPtr gamma=nullptr, ITensorAccessorUPtr beta=nullptr, float epsilon=0.001f)
 Construct a batch normalization layer. More...
 
NodeID create_layer (IStream &s) override
 Create layer and add to the given stream. More...
 
- Public Member Functions inherited from ILayer
virtual ~ILayer ()=default
 Default destructor. More...
 
ILayerset_name (std::string name)
 Sets the name of the layer. More...
 
const std::string & name () const
 Layer name accessor. More...
 

Detailed Description

Batchnormalization Layer.

Definition at line 191 of file Layers.h.

Constructor & Destructor Documentation

◆ BatchNormalizationLayer()

BatchNormalizationLayer ( ITensorAccessorUPtr  mean,
ITensorAccessorUPtr  var,
ITensorAccessorUPtr  gamma = nullptr,
ITensorAccessorUPtr  beta = nullptr,
float  epsilon = 0.001f 
)
inline

Construct a batch normalization layer.

Parameters
[in]meanAccessor to get mean tensor data from.
[in]varAccessor to get var tensor data from.
[in]gamma(Optional) Accessor to get gamma tensor data from. Default: nullptr.
[in]beta(Optional) Accessor to get beta tensor data from. Default: nullptr.
[in]epsilon(Optional) Epsilon value. Default: 0.001.

Definition at line 202 of file Layers.h.

207  : _mean(std::move(mean)), _var(std::move(var)), _gamma(std::move(gamma)), _beta(std::move(beta)), _epsilon(epsilon)
208  {
209  }

Member Function Documentation

◆ create_layer()

NodeID create_layer ( IStream s)
inlineoverridevirtual

Create layer and add to the given stream.

Parameters
[in]sStream to add layer to.
Returns
ID of the created node.

Implements ILayer.

Definition at line 211 of file Layers.h.

References GraphBuilder::add_batch_normalization_node(), ARM_COMPUTE_ERROR_ON, IStream::graph(), IStream::hints(), arm_compute::test::validation::input, ILayer::name(), IStream::tail_node(), and StreamHints::target_hint.

212  {
213  ARM_COMPUTE_ERROR_ON(_mean == nullptr);
214  ARM_COMPUTE_ERROR_ON(_var == nullptr);
215 
216  NodeParams common_params = { name(), s.hints().target_hint };
217  NodeIdxPair input = { s.tail_node(), 0 };
218  return GraphBuilder::add_batch_normalization_node(s.graph(), common_params, input, _epsilon,
219  std::move(_mean), std::move(_var), std::move(_beta), std::move(_gamma));
220  }
static NodeID add_batch_normalization_node(Graph &g, NodeParams params, NodeIdxPair input, float epsilon, ITensorAccessorUPtr mean_accessor=nullptr, ITensorAccessorUPtr var_accessor=nullptr, ITensorAccessorUPtr beta_accessor=nullptr, ITensorAccessorUPtr gamma_accessor=nullptr)
Adds a batch normalization layer node to the graph.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
const std::string & name() const
Layer name accessor.
Definition: ILayer.h:64

The documentation for this class was generated from the following file: