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
Thomas