A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.jax.dev/en/latest/_autosummary/jax.numpy.indices.html below:

jax.numpy.indices — JAX documentation

jax.numpy.indices#
jax.numpy.indices(dimensions, dtype=None, sparse=False)[source]#

Generate arrays of grid indices.

JAX implementation of numpy.indices().

Parameters:
  • dimensions (Sequence[int]) – the shape of the grid.

  • dtype (DTypeLike | None | None) – the dtype of the indices (defaults to integer).

  • sparse (bool) – if True, then return sparse indices. Default is False, which returns dense indices.

Returns:

An array of shape (len(dimensions), *dimensions) If sparse is False, or a sequence of arrays of the same length as dimensions if sparse is True.

Return type:

Array | tuple[Array, …]

Examples

>>> jnp.indices((2, 3))
Array([[[0, 0, 0],
        [1, 1, 1]],

       [[0, 1, 2],
        [0, 1, 2]]], dtype=int32)
>>> jnp.indices((2, 3), sparse=True)
(Array([[0],
       [1]], dtype=int32), Array([[0, 1, 2]], dtype=int32))

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3