oneflow.Tensor.cpu

Tensor.cpu()

Returns a copy of this object in CPU memory. If this object is already in CPU memory and on the correct device, then no copy is performed and the original object is returned.

For example:

>>> import oneflow as flow

>>> input = flow.tensor([1, 2, 3, 4, 5], device=flow.device("cuda"))
>>> output = input.cpu()
>>> output.device
device(type='cpu', index=0)