class

ML::NN::LayerNorm

Inherits Reference / Object

Layer Normalization: y = (x - mean) / sqrt(var + eps) * gamma + beta

Constructors

new(dim : Int32, eps : Float32 = 1e-5_f32, device : Tensor::Device = Tensor.default_device)

Convenience constructor for single dimension

Source
new(normalized_shape : Array(Int32) | Int32, eps : Float32 = 1e-5_f32, device : Tensor::Device = Tensor.default_device)
Source

Instance methods

bias
Source
call(x : Autograd::Variable) : Autograd::Variable
Source
forward(x : Autograd::Variable) : Autograd::Variable

Forward pass x: [..., *normalized_shape] output: same shape as x

Source
normalized_shape
Source
parameters

Get all trainable parameters

Source
weight
Source