LayerNorm(dimension: int, eps: float = 1e-06)¶
An implementation of Layer Normalization .
Layer Normalization stabilises the training of deep neural networks by normalising the outputs of neurons from a particular layer. It computes:
output = (gamma * (tensor - mean) / (std + eps)) + beta
The dimension of the layer output to normalize.
float, optional, (default = 1e-6)
An epsilon to prevent dividing by zero in the case the layer has zero variance.
- The normalized layer output.
Defines the computation performed at every call.
Should be overridden by all subclasses.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.