Skip to content

Commit

Permalink
[Doc] Add AOTInductor back
Browse files Browse the repository at this point in the history
ghstack-source-id: 774eb5973045861f284fdc67f74945b1eecdeaf2
Pull Request resolved: #2564
  • Loading branch information
vmoens committed Nov 14, 2024
1 parent 9d292a0 commit 9f8f77c
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tutorials/sphinx-tutorials/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,25 +338,25 @@
# `AOTI documentation <https://pytorch.org/docs/main/torch.compiler_aot_inductor.html>`_:
#

# from tempfile import TemporaryDirectory
#
# from torch._inductor import aoti_compile_and_package, aoti_load_package
#
# with TemporaryDirectory() as tmpdir:
# path = str(Path(tmpdir) / "model.pt2")
# with torch.no_grad():
# pkg_path = aoti_compile_and_package(
# exported_policy,
# args=(),
# kwargs={"pixels": pixels},
# # Specify the generated shared library path
# package_path=path,
# )
# print("pkg_path", pkg_path)
#
# compiled_module = aoti_load_package(pkg_path)
#
# print(compiled_module(pixels=pixels))
from tempfile import TemporaryDirectory

from torch._inductor import aoti_compile_and_package, aoti_load_package

with TemporaryDirectory() as tmpdir:
path = str(Path(tmpdir) / "model.pt2")
with torch.no_grad():
pkg_path = aoti_compile_and_package(
exported_policy,
args=(),
kwargs={"pixels": pixels},
# Specify the generated shared library path
package_path=path,
)
print("pkg_path", pkg_path)

compiled_module = aoti_load_package(pkg_path)

print(compiled_module(pixels=pixels))

#####################################
#
Expand Down

0 comments on commit 9f8f77c

Please sign in to comment.