计算输入tensor的元素总数。
input_x (Tensor) - 输入tensor。
int
Ascend GPU CPU
Ascend
GPU
CPU
样例:
>>> import mindspore >>> input_x = mindspore.tensor([[2, 2], [2, 2]], mindspore.float32) >>> output = mindspore.ops.size(input_x) >>> print(output) 4