torch.Tensor.xpu — PyTorch 2.7 documentation (original) (raw)

Tensor.xpu(device=None, non_blocking=False, memory_format=torch.preserve_format) → Tensor

Returns a copy of this object in XPU memory.

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

Parameters