mindspore.Tensor.long

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

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