Skip to content

Constant

Constant initializer which always returns the same value.

Parameters

  • value

    Typefloat

Examples

from river import optim

init = optim.initializers.Constant(value=3.14)

init(shape=1)
3.14

init(shape=2)
array([3.14, 3.14])

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