Read Torch export Exir/ExportedProgram from C++

Given a model that has been exported using the torch.export API from Python and serialized as a EXIR/ExportedProgram.

Is there a way of loading the serialized model for inspection/traversal using the C++ API in a similar way we can do it with TorchScript IR?

Note that I’m not referring to inference, I’m aware that it is possible to compile the model into a shared library with AOTInductor. I’m more interested on export a model with torch.export into EXIR/ExportedProgram and read the contents of the model (traverse the graph, inspect nodes…etc) from C++ API.

If it is not possible, are there any plans to add an C++ API for being able to do this?

1 Like