fn
zeros_
→Tensorzeros_(tensor: Tensor)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
tensorTensorTensor to fill in place; any shape is accepted.
Returns
Tensortensor (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)