torch.Tensor.storage_offset¶ Tensor.storage_offset() → int¶ 返回 self 張量在底層儲存中的偏移量,單位為儲存元素數量(而非位元組)。 示例 >>> x = torch.tensor([1, 2, 3, 4, 5]) >>> x.storage_offset() 0 >>> x[3:].storage_offset() 3