flax.linen.initializers.ones#

flax.linen.initializers.ones(key, shape, dtype=<class 'jax.numpy.float64'>)[source]#

An initializer that returns a constant array full of ones.

The key argument is ignored.

>>> import jax, jax.numpy as jnp
>>> jax.nn.initializers.ones(jax.random.PRNGKey(42), (3, 2), jnp.float32)
Array([[1., 1.],
       [1., 1.],
       [1., 1.]], dtype=float32)