Shortcuts

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.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources