Skip to content

Commit 1375373

Browse files
agunapalangelayisvekars
authored
Apply suggestions from code review
Co-authored-by: Angela Yi <[email protected]> Co-authored-by: Svetlana Karslioglu <[email protected]>
1 parent a6f6cd9 commit 1375373

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

intermediate_source/torch_export_aoti_python.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,15 @@
8888

8989
# min=2 is not a bug and is explained in the 0/1 Specialization Problem
9090
batch_dim = torch.export.Dim("batch", min=2, max=32)
91-
so_path = torch._export.aot_compile(
91+
exported_program = torch.export.export(
9292
model,
9393
example_inputs,
9494
# Specify the first dimension of the input x as dynamic
9595
dynamic_shapes={"x": {0: batch_dim}},
96+
)
97+
so_path = torch._inductor.aot_compile(
98+
exported_program.module(),
99+
example_inputs,
96100
# Specify the generated shared library path
97101
options=aot_compile_options
98102
)
@@ -211,7 +215,7 @@ def timed(fn):
211215
# Conclusion
212216
# ----------
213217
#
214-
# In this tutorial, we have learned how to effectively use the AOTInductor for Python runtime by
218+
# In this recipe, we have learned how to effectively use the AOTInductor for Python runtime by
215219
# compiling and loading a pretrained ``ResNet18`` model using the ``torch._export.aot_compile``
216220
# and ``torch._export.aot_load`` APIs. This process demonstrates the practical application of
217221
# generating a shared library and running it within a Python environment, even with dynamic shape

0 commit comments

Comments
 (0)