Skip to content

Zeros

Constant initializer which always returns zeros.

Examples

from river import optim

init = optim.initializers.Zeros()

init(shape=1)
0.0

init(shape=2)
array([0., 0.])

Methods

call

Returns a fresh set of weights.

The return type is shape-dependent (a scalar when shape == 1, otherwise an array), and these values are routinely used as collections.defaultdict factories elsewhere, so the return is intentionally left dynamic.

Parameters

  • shapeint — defaults to 1