fn

zeros_

Tensor
zeros_(tensor: Tensor)
source

Fill tensor in-place with zeros.

Convenience wrapper around constant_ with val=0.0. The canonical use case is bias initialisation in linear and convolution layers, and the shift (beta) parameter of normalisation layers.

Parameters

tensorTensor
Tensor to fill in place; any shape is accepted.

Returns

Tensor

tensor (mutated) for chaining.

Notes

Equivalent to constant_ (tensor, 0.0). Note that zero-filling a weight matrix would prevent symmetry breaking and block learning — use only for biases or normalisation shifts.

Examples

>>> import lucid
>>> from lucid.nn.init import zeros_
>>> bias = lucid.empty(128)
>>> zeros_(bias)