Table of Contents
Shortcuts

# torch.Tensor.dim_order

Tensor.dim_order() → tuple

  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

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.