pytorch / 2 / generated / torch.tensor.storage_offset.html

torch.Tensor.storage_offset

Tensor.storage_offset() → int

Returns self tensor’s offset in the underlying storage in terms of number of storage elements (not bytes).

Example:

>>> x = torch.tensor([1, 2, 3, 4, 5])
>>> x.storage_offset()
0
>>> x[3:].storage_offset()
3

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.Tensor.storage_offset.html