torch.Tensor.contiguous¶
- Tensor.contiguous(memory_format=torch.contiguous_format) Tensor ¶
返回一個在記憶體中連續的張量,其中包含與
self
張量相同的資料。 如果self
張量已經是指定的記憶體格式,此函數會返回self
張量。- 參數
memory_format (
torch.memory_format
, optional) – 返回張量所需的記憶體格式。預設值:torch.contiguous_format
。