mindspore.Tensor.to_
- Tensor.to_(device=None, non_blocking=False)[source]
In-place version of
mindspore.Tensor.to(), converts the device of the original tensor to the specified device and returns the tensor.Warning
This interface is deprecated and will be removed after version 2.9.0.
- Parameters
- Returns
Tensor, the modified self itself, which is stored on the specified device.
Examples
>>> import mindspore as ms >>> x = ms.Tensor([1, 2, 3, 4]) >>> x.to_(device="Ascend", non_blocking=True) >>> print(x.device) "Ascend:0"