mindspore.ops.numel

View Source On Gitee
mindspore.ops.numel(input)[source]

Return the total number of elements in the tensor.

Parameters

input (Tensor) – The input tensor.

Returns

The total number of elements in tensor.

Supported Platforms:

Ascend GPU CPU

Examples

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