torch.Tensor.contiguous¶
- Tensor.contiguous(memory_format=torch.contiguous_format) 张量¶
返回一个在内存中连续的张量,包含与
self张量相同的数据。如果self张量已经在指定的内存格式中,此函数返回self张量。- Parameters
memory_format (
torch.memory_format, 可选) – 返回的张量所需的内存格式。默认值:torch.contiguous_format。