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.diag_indices_from.html below:

jax.numpy.diag_indices_from — JAX documentation

jax.numpy.diag_indices_from#
jax.numpy.diag_indices_from(arr)[source]#

Return indices for accessing the main diagonal of a given array.

JAX implementation of numpy.diag_indices_from().

Parameters:

arr (ArrayLike) – Input array. Must be at least 2-dimensional and have equal length along all dimensions.

Returns:

A tuple of arrays containing the indices to access the main diagonal of the input array.

Return type:

tuple[Array, …]

Examples

>>> arr = jnp.array([[1, 2, 3],
...                  [4, 5, 6],
...                  [7, 8, 9]])
>>> jnp.diag_indices_from(arr)
(Array([0, 1, 2], dtype=int32), Array([0, 1, 2], dtype=int32))
>>> arr = jnp.array([[[1, 2], [3, 4]],
...                  [[5, 6], [7, 8]]])
>>> jnp.diag_indices_from(arr)
(Array([0, 1], dtype=int32),
Array([0, 1], dtype=int32),
Array([0, 1], 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