mindspore.numpy.size
- mindspore.numpy.size(a, axis=None)[源代码]
Returns the number of elements along a given axis.
- Parameters
- Returns
Number of elements along the specified axis.
- Supported Platforms:
Ascend
GPU
CPU
- Raises
TypeError – If input is not array_like or axis is not int.
ValueError – If any axis is out of range or duplicate axes exist.
Examples
>>> import mindspore.numpy as np >>> x = np.arange(10).reshape(2, 5).astype('float32') >>> print(np.size(x)) 10 >>> print(np.size(x, axis=1)) 5