dpnp.ndim

dpnp.ndim(a)[source]

Return the number of dimensions of array-like input.

For full documentation refer to numpy.ndim.

Parameters:

a (array_like) -- Input data.

Returns:

number_of_dimensions -- The number of dimensions in a. Scalars are zero-dimensional.

Return type:

int

See also

dpnp.ndarray.ndim

Equivalent method for dpnp.ndarray or usm_ndarray input.

dpnp.shape

Return the shape of an array.

dpnp.ndarray.shape

Return the shape of an array.

Examples

>>> import dpnp as np
>>> a = [[1, 2, 3], [4, 5, 6]]
>>> np.ndim(a)
2
>>> a = np.asarray(a)
>>> np.ndim(a)
2
>>> np.ndim(1)
0