Skip to content

Commit b1cd8bb

Browse files
committed
Fix more typos
1 parent 167921f commit b1cd8bb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

intermediate_source/named_tensor_tutorial.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
This tutorial is intended as a guide to the functionality that will
1616
be included with the 1.3 launch. By the end of it, you will be able to:
1717
18-
- Create ``Tensor``s with named dimensions, as well as remove or rename those
18+
- Create Tensors with named dimensions, as well as remove or rename those
1919
dimensions
2020
- Understand the basics of how operations propagate dimension names
2121
- See how naming dimensions enables clearer code in two key areas:
@@ -192,17 +192,19 @@ def catch_error(fn):
192192
# broadcasted, PyTorch also checks that the names of those dimensions match.
193193
#
194194
# This results in named tensors preventing unintended alignment during
195-
# operations that broadcast. Without ``names``, ``per_batch_scale`` would be
196-
# aligned with the last dimension of ``imgs``, which is not what we intended.
195+
# operations that broadcast. In the below example, we apply a
196+
# ``per_batch_scale`` to ``imgs``.
197197

198198
imgs = torch.randn(2, 2, 2, 2, names=('N', 'C', 'H', 'W'))
199199
per_batch_scale = torch.rand(2, names=('N',))
200200
catch_error(lambda: imgs * per_batch_scale)
201201

202202
######################################################################
203-
# We really wanted to perform the operation by aligning ``per_batch_scale``
204-
# with the batch dimension of ``imgs``.
205-
# See the new explicit broadcasting by names functionality for how to
203+
# Without ``names``, the ``per_batch_scale`` tensor is aligned with the last
204+
# dimension of ``imgs``, which is not what we intended. We really wanted to
205+
# perform the operation by aligning ``per_batch_scale`` with the batch
206+
# dimension of ``imgs``.
207+
# See the new "explicit broadcasting by names" functionality for how to
206208
# align tensors by name, covered below.
207209
#
208210
# Matrix multiply

0 commit comments

Comments
 (0)