Returns a copy of this object in CUDA memory. If this object is already in CUDA memory and on the correct device, then no copy is performed and the original object is returned.
device (flow.device) – The destination GPU device. Defaults to the current CUDA device.
>>> import oneflow as flow >>> input = flow.Tensor([1, 2, 3, 4, 5]) >>> output = input.cuda() >>> output.device device(type='cuda', index=0)