Initializing Module Parameters

Initializing Module Parameters#

The xlnstorch.nn.init module provides functions to initialize the parameters of layers in the xlnstorch.nn module. These functions modify the input LNSTensor in-place and are analogous to the torch.nn.init functions.

uniform_(tensor[, a, b, generator])

Fills the input tensor with random numbers from a uniform distribution.

normal_(tensor[, mean, std, generator])

Fills the input tensor with random numbers from a normal distribution.

zeros_(tensor)

Fills the input tensor with zeros.

ones_(tensor)

Fills the input tensor with ones.

constant_(tensor, value)

Fills the input tensor with a constant value.

eye_(tensor)

Fills the input 2D tensor with ones on the diagonal and zeros elsewhere.

xavier_uniform_(tensor[, gain, generator])

Fills the input tensor with values according to the Xavier uniform initialization.

xavier_normal_(tensor[, gain, generator])

Fills the input tensor with values according to the Xavier normal initialization.