der that they appear in ` self  ` .

Python 2 does not support Ellipsis but one may use a string literal instead (
` '...'  ` ).

Parameters

    

**names** ( _iterable of str_ ) – The desired dimension ordering of the output
tensor. May contain up to one Ellipsis that is expanded to all unmentioned dim
names of ` self  ` .

Examples:

    
    
    >>> tensor = torch.randn(2, 2, 2, 2, 2, 2)
    >>> named_tensor = tensor.refine_names('A', 'B', 'C', 'D', 'E', 'F')
    
    # Move the F and E dims to the front while keeping the rest in order
    >>> named_tensor.align_to('F', 'E', ...)
    

Warning

The named tensor API is experimental and subject to change.

` unflatten ` (  _dim_ , _namedshape_ )  [ [source]
](_modules/torch/tensor.html#Tensor.unflatten) ¶

    

Unflattens the named dimension [ ` dim  ` ](tensors.html#torch.Tensor.dim
"torch.Tensor.dim") , viewing it in the shape specified by ` namedshape  ` .

Parameters

    

**namedshape** – (iterable of ` (name,  size)  ` tuples).

Examples:

    
    
    >>> flat_imgs = torch.rand(32, 3 * 128 * 128, names=('N', 'features'))
    >>> imgs = flat_imgs.unflatten('features', (('C', 3), ('H', 128), ('W', 128)))
    >>> imgs.names, imgs.shape
    (('N', 'C', 'H', 'W'), torch.Size([32, 3, 128, 128]))
    

Warning

The named tensor API is experimental and subject to change.

` flatten ` (  _dims_ , _out_dim_ )  → Tensor

    

Flattens ` dims  ` into a single dimension with name ` out_dim  ` .

All of  dims  must be consecutive in order in the ` self  ` tensor, but not
necessary contiguous in memory.

Examples:

    
    
    >>> imgs = torch.randn(32, 3, 128, 128, names=('N', 'C', 'H', 'W'))
    >>> flat_imgs = imgs.flatten(['C', 'H', 'W'], 'features')
    >>> flat_imgs.names, flat_imgs.shape
    (('N', 'features'), torch.Size([32, 49152]))
    

Warning

The named tensor API is a prototype feature and subject to change.

[ Next ![](_static/images/chevron-right-orange.svg) ](name_inference.html
"Named Tensors operator coverage") [ ![](_static/images/chevron-right-
orange.svg) Previous ](type_info.html "Type Info")

* * *

© Copyright 2019, Torch Contributors.

Built with [ Sphinx ](http://sphinx-doc.org/) using a [ theme
](https://github.com/rtfd/sphinx_rtd_theme) provided by [ Read the Docs
](https://readthedocs.org) .

  * Named Tensors 
    * Creating named tensors 
    * Named dimensions 
    * Name propagation semantics 
      * match semantics 
      * Basic name inference rules 
    * Explicit alignment by names 
    * Manipulating dimensions 
    * Autograd support 
    * Currently supported operations and subsystems 
      * Operators 
      * Subsystems 
    * Named tensor API reference 

![](https://www.googleadservices.com/pagead/conversion/795629140/?label=txkmCPmdtosBENSssfsC&guid=ON&script=0)

##  Docs

Access comprehensive developer documentation for PyTorch

[ View Docs ](https://pytorch.org/docs/stable/index.html)

##  Tutorials

Get in-depth tutorials for beginners and advanced developers

[ View Tutorials ](https://pytorch.org/tutorials)

##  Resources

Find development resources and get your questions answered

[ View Resources ](https://pytorch.org/resources)

[ ](https://pytorch.org/)

  * [ PyTorch ](https://pytorch.org/)
  * [ Get Started ](https://pytorch.org/get-started)
  * [ Features ](https://pytorch.org/features)
  * [ Ecosystem ](https://pytorch.org/ecosystem)
  * [ Blog ](https://pytorch.org/blog/)
  * [ Contributing ](https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md)

  * [ Resources ](https://pytorch.org/resources)
  * [ Tutorials ](https://pytorch.org/tutorials)
  * [ Docs ](https://pytorch.org/docs/stable/index.html)
  * [ Discuss ](https://discuss.pytorch.org)
  * [ Github Issues ](https://github.com/pytorch/pytorch/issues)
  * [ Brand Guidelines ](https://pytorch.org/assets/brand-guidelines/PyTorch-Brand-Guidelines.pdf)

  * Stay Connected 
  * Email Address 

[ ](https://www.facebook.com/pytorch) [ ](https://twitter.com/