torch.Tensor.contiguous
- contiguous(memory_format=torch.contiguous_format) → 张量
-
返回一个与
self张量数据相同的、在内存中连续的张量。如果self张量已经以指定的内存格式存在,则直接返回该张量。- 参数
-
memory_format (
torch.memory_format, 可选) – 指定返回张量的内存格式。默认值为torch.contiguous_format。
返回一个与 self 张量数据相同的、在内存中连续的张量。如果 self 张量已经以指定的内存格式存在,则直接返回该张量。
memory_format (torch.memory_format, 可选) – 指定返回张量的内存格式。默认值为 torch.contiguous_format。