mindspore.ops.size

View Source On Gitee
mindspore.ops.size(input_x)[source]

Count the total number of elements in input_x .

Parameters

input_x (Tensor) – The input tensor.

Returns

int

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input_x = mindspore.tensor([[2, 2], [2, 2]], mindspore.float32)
>>> output = mindspore.ops.size(input_x)
>>> print(output)
4