Skip to content

Commit 9f8f77c

Browse files
author
Vincent Moens
committed
[Doc] Add AOTInductor back
ghstack-source-id: 774eb59 Pull Request resolved: #2564
1 parent 9d292a0 commit 9f8f77c

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

tutorials/sphinx-tutorials/export.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -338,25 +338,25 @@
338338
# `AOTI documentation <https://pytorch.org/docs/main/torch.compiler_aot_inductor.html>`_:
339339
#
340340

341-
# from tempfile import TemporaryDirectory
342-
#
343-
# from torch._inductor import aoti_compile_and_package, aoti_load_package
344-
#
345-
# with TemporaryDirectory() as tmpdir:
346-
# path = str(Path(tmpdir) / "model.pt2")
347-
# with torch.no_grad():
348-
# pkg_path = aoti_compile_and_package(
349-
# exported_policy,
350-
# args=(),
351-
# kwargs={"pixels": pixels},
352-
# # Specify the generated shared library path
353-
# package_path=path,
354-
# )
355-
# print("pkg_path", pkg_path)
356-
#
357-
# compiled_module = aoti_load_package(pkg_path)
358-
#
359-
# print(compiled_module(pixels=pixels))
341+
from tempfile import TemporaryDirectory
342+
343+
from torch._inductor import aoti_compile_and_package, aoti_load_package
344+
345+
with TemporaryDirectory() as tmpdir:
346+
path = str(Path(tmpdir) / "model.pt2")
347+
with torch.no_grad():
348+
pkg_path = aoti_compile_and_package(
349+
exported_policy,
350+
args=(),
351+
kwargs={"pixels": pixels},
352+
# Specify the generated shared library path
353+
package_path=path,
354+
)
355+
print("pkg_path", pkg_path)
356+
357+
compiled_module = aoti_load_package(pkg_path)
358+
359+
print(compiled_module(pixels=pixels))
360360

361361
#####################################
362362
#

0 commit comments

Comments
 (0)