From 2e054037da7c1b30fefa6372d03096c2dfc01cdf Mon Sep 17 00:00:00 2001 From: Alexander Jipa Date: Tue, 22 Aug 2023 18:00:10 +0000 Subject: [PATCH] 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 --- docs/source/named_tensor.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/named_tensor.rst b/docs/source/named_tensor.rst index cd8ac28466d..112682e7b26 100644 --- a/docs/source/named_tensor.rst +++ b/docs/source/named_tensor.rst @@ -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: