mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
fixing named tensor unflatten example (#106921)
Fixes an example from the documentation [here](https://pytorch.org/docs/stable/named_tensor.html#manipulating-dimensions). Pull Request resolved: https://github.com/pytorch/pytorch/pull/106921 Approved by: https://github.com/zou3519
This commit is contained in:
parent
28dc1a093f
commit
2e054037da
1 changed files with 3 additions and 3 deletions
|
|
@ -204,9 +204,9 @@ and :meth:`~Tensor.reshape`, but have more semantic meaning to someone reading t
|
|||
>>> named_flat_imgs.names
|
||||
('N', 'features')
|
||||
|
||||
>>> unflattened_imgs = imgs.view(32, 3, 128, 128)
|
||||
>>> unflattened_named_imgs = named_flat_imgs.unflatten(
|
||||
'features', [('C', 3), ('H', 128), ('W', 128)])
|
||||
>>> unflattened_named_imgs = named_flat_imgs.unflatten('features', [('C', 3), ('H', 128), ('W', 128)])
|
||||
>>> unflattened_named_imgs.names
|
||||
('N', 'C', 'H', 'W')
|
||||
|
||||
.. _named_tensors_autograd-doc:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue