mindspore.Tensor.long

View Source On Gitee
Tensor.long()[source]

Converts input tensor dtype to int64. If the value in tensor is float or half, the decimal will be discarded.

Returns

Tensor, converted to the int64 dtype.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import numpy as np
>>> import mindspore
>>> from mindspore import Tensor
>>> input_x = Tensor(np.ones([2,2]), mindspore.int32)
>>> output = input_x.long()
>>> print(output.dtype)
Int64