AD graph transformations, such as canonicalize_graph(gm: GraphModule, ...) -> GraphModule have a signature that implies that they return a transformed graph instance while leaving the gm unchanged. These transformations actually mutate the GraphModule instance in-place, which can be confusing.
Change all transform_graph(gm: GraphModule, ...) -> GraphModule to transform_graph(gm: GraphModule, ...) -> None and fix the code accordingly.
see slack conv: https://nvidia.slack.com/archives/C08T73CRBA6/p1749730434523839
AD graph transformations, such as
canonicalize_graph(gm: GraphModule, ...) -> GraphModulehave a signature that implies that they return a transformed graph instance while leaving thegmunchanged. These transformations actually mutate theGraphModuleinstance in-place, which can be confusing.Change all
transform_graph(gm: GraphModule, ...) -> GraphModuletotransform_graph(gm: GraphModule, ...) -> Noneand fix the code accordingly.see slack conv: https://nvidia.slack.com/archives/C08T73CRBA6/p1749730434523839