Skip to content

Commit 82efe6b

Browse files
authored
Update torch_export_tutorial.py
1 parent f4a38da commit 82efe6b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

intermediate_source/torch_export_tutorial.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def forward(
339339
model(w, x, torch.randn(3, 4), torch.randn(12))
340340
ep.module()(w, x, torch.randn(3, 4), torch.randn(12))
341341

342+
######################################################################
342343
# Basic concepts: symbols and guards
343344
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344345

@@ -360,7 +361,7 @@ def forward(
360361
######################################################################
361362
# Before we look at the program that's produced, let's understand what specifying ``dynamic_shapes`` entails,
362363
# and how that interacts with export. For every input dimension where a ``Dim`` object is specified, a symbol is
363-
# `allocated <https://pytorch.org/docs/main/export.programming_model.html#basics-of-symbolic-shapes>`,
364+
# `allocated <https://pytorch.org/docs/main/export.programming_model.html#basics-of-symbolic-shapes>`_,
364365
# taking on a range of ``[2, inf]`` (why not ``[0, inf]`` or ``[1, inf]``? we'll explain later in the
365366
# 0/1 specialization section).
366367
#
@@ -523,6 +524,7 @@ def forward(self, w, x, y, z):
523524
# Additionally, you might ask why we traced only the ``if`` branch, and if it's possible to maintain control-flow in your program and keep both branches
524525
# alive. For that, refer to rewriting your model code following the ``Control Flow Ops`` section above.
525526

527+
######################################################################
526528
# 0/1 specialization
527529
# ^^^^^^^^^^^^^^^^^^
528530

@@ -541,6 +543,7 @@ def forward(self, w, x, y, z):
541543
)
542544
ep.module()(torch.randn(2, 4))
543545

546+
######################################################################
544547
# Named Dims
545548
# ^^^^^^^^^^
546549

@@ -579,6 +582,7 @@ def forward(self, w, x, y, z):
579582
"x": (4 * dx, None) # x.shape[0] has range [16, 2048], and is divisible by 4.
580583
}
581584

585+
######################################################################
582586
# Constraint violations, suggested fixes
583587
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
584588

0 commit comments

Comments
 (0)