dpnp.size

dpnp.size(a, axis=None)[source]

Return the number of elements along a given axis.

For full documentation refer to numpy.size.

Parameters:
  • a (array_like) -- Input data.

  • axis ({None, int}, optional) -- Axis along which the elements are counted. By default, give the total number of elements. Default: None.

Returns:

element_count -- Number of elements along the specified axis.

Return type:

int

See also

dpnp.ndarray.size

number of elements in array.

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.size(a)
6
>>> np.size(a, 1)
3
>>> np.size(a, 0)
2
>>> a = np.asarray(a)
>>> np.size(a)
6
>>> np.size(a, 1)
3