jax.numpy.zeros#

jax.numpy.zeros(shape, dtype=None, *, device=None)[source]#

Create an array full of zeros.

JAX implementation of numpy.zeros().

Parameters:
  • shape (Any) – int or sequence of ints specifying the shape of the created array.

  • dtype (str | type[Any] | dtype | SupportsDType | None) – optional dtype for the created array; defaults to floating point.

  • device (Device | Sharding | None) – (optional) Device or Sharding to which the created array will be committed.

Returns:

Array of the specified shape and dtype, on the specified device if specified.

Return type:

Array

Examples

>>> jnp.zeros(4)
Array([0., 0., 0., 0.], dtype=float32)
>>> jnp.zeros((2, 3), dtype=bool)
Array([[False, False, False],
       [False, False, False]], dtype=bool)