torch.Tensor.cpu

Tensor.cpu(memory_format=torch.preserve_format)Tensor

返回该对象在CPU内存中的副本。

如果该对象已经在 CPU 内存中并且位于正确设备上,则不会进行复制操作,直接返回原始对象。

参数

memory_format (torch.memory_format, 可选) – 指定返回的张量的内存格式。默认值为:torch.preserve_format

本页目录