Is torch.Graph executable?

Hi, I’m interested in the optimization of a PyTorch JIT graph. For this purpose, I want to find a way to execute an existing torch.Graph directly. Is there any official or unofficial way for this purpose?

1 Like

I found a private API torch._C._create_function_from_graph(name, graph) which reconstructs a torch.Function from an existing JIT graph.

The usual thing to do is to transform the graph. This is what the various passes in the JIT do and you can also register custom passes. For example, the difference between fn.graph and fn.graph_for(*inputs) comes from the passes executed after specialization of the input arguments.

Best regards