mindspore.ops.numel
- mindspore.ops.numel(x)[source]
Returns a Scalar of type int that represents the total number of elements in the Tensor.
- Parameters
x (Tensor) – Input Tensor.
- Returns
int. A scalar representing the total of elements in the Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_x = Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32) >>> print(ops.numel(input_x)) 4