File tree Expand file tree Collapse file tree 1 file changed +19
-19
lines changed
tutorials/sphinx-tutorials Expand file tree Collapse file tree 1 file changed +19
-19
lines changed Original file line number Diff line number Diff line change 338
338
# `AOTI documentation <https://pytorch.org/docs/main/torch.compiler_aot_inductor.html>`_:
339
339
#
340
340
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 ))
360
360
361
361
#####################################
362
362
#
You can’t perform that action at this time.
0 commit comments