mindspore.Tensor.float

Tensor.float()[source]

Converts input tensor dtype to float32.

Returns

Tensor, converted to the float32 dtype.

Supported Platforms:

Ascend GPU CPU

Examples

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