评价此页

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