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

torch.Tensor.dim_order

Tensor.dim_order() → tuple [source]

Returns a tuple of int describing the dim order or physical layout of self.

Parameters

None –

Dim order represents how dimensions are laid out in memory, starting from the outermost to the innermost dimension.

Example::
>>> torch.empty((2, 3, 5, 7)).dim_order()
(0, 1, 2, 3)
>>> torch.empty((2, 3, 5, 7), memory_format=torch.channels_last).dim_order()
(0, 2, 3, 1)

Warning

The dim_order tensor API is experimental and subject to change.

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