AOTInductor (AOTI) is PyTorch’s ahead-of-time compiler for running inference from an exported computation graph. It compiles the graph into optimized executable code and packages the result for later loading. section 17.2.2
A typical deployment workflow is:
- Export a PyTorch model with torch.export, producing a graph whose parameters become inputs and whose layers become lower-level torch.ops.aten operations. section 17.2.2
- Compile and package the exported program with torch._inductor.aoti_compile_and_package. section 17.2.2
- Load the package with torch._inductor.aoti_load_package and call the resulting model for inference. section 17.2.2
Compile and reload an exported model
output_path = torch._inductor.aoti_compile_and_package(exported_program, package_path="model.pt2") model = torch._inductor.aoti_load_package("model.pt2") model(dummy_input) The compiled model is optimized for the input shapes used during export, so later inputs must match those shapes. section 17.2.2
