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 is an experimental API that is subject to change or deletion.
- 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"