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

jax.numpy.ndim — JAX documentation

jax.numpy.ndim#
jax.numpy.ndim(a)[source]#

Return the number of dimensions of an array.

JAX implementation of numpy.ndim(). Unlike np.ndim, this function raises a TypeError if the input is a collection such as a list or tuple.

Parameters:

a (ArrayLike | SupportsNdim) – array-like object, or any object with an ndim attribute.

Returns:

An integer specifying the number of dimensions of a.

Return type:

int

Examples

Number of dimensions for arrays:

>>> x = jnp.arange(10)
>>> jnp.ndim(x)
1
>>> y = jnp.ones((2, 3))
>>> jnp.ndim(y)
2

This also works for scalars:

For arrays, this can also be accessed via the jax.Array.ndim property:


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