mindspore.numpy.size
- mindspore.numpy.size(a, axis=None)[源代码]
Returns the number of elements along a given axis.
- 参数
- 返回
Number of elements along the specified axis.
- Supported Platforms:
Ascend
GPU
CPU
- 异常
TypeError – If input is not array_like or axis is not int.
ValueError – If any axis is out of range or duplicate axes exist.
样例
>>> 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