torch.Tensor.xpu¶
- Tensor.xpu(device=None, non_blocking=False, memory_format=torch.preserve_format) Tensor ¶
返回此对象在 XPU 内存中的副本。
如果此对象已在 XPU 内存中且位于正确的设备上,则不会执行复制操作,而是返回原始对象。
- 参数
device (
torch.device
) – 目标 XPU 设备。默认为当前的 XPU 设备。non_blocking (bool) – 如果为
True
且源位于固定内存 (pinned memory) 中,则复制相对于主机是异步的。否则,此参数无效。默认值:False
。memory_format (
torch.memory_format
, 可选) – 返回 Tensor 所需的内存格式。默认值:torch.preserve_format
。