Shortcuts

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
优云智算