You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add parent/root tracking to GraphBuilder for subgraph Parameter realization (#2877)
GraphBuilder now accepts an optional parent parameter. When provided,
_root points to the root builder of the parent chain, ensuring that
Parameter._realize() registers initializers in the main (root) graph
rather than in the subgraph where the parameter is referenced.
This is needed for ONNX Scan/Loop body subgraphs where nn.Module
parameters must be stored in the root graph instead of the attribute
subgraph.
Changes:
- GraphBuilder.__init__: accept parent, store _parent and _root
- build_graph(): accept and forward parent to sub-builder
- GraphBuilder.subgraph(): pass parent=self to build_graph()
- Parameter._realize(): use builder._root for name qualification and
initializer registration
Signed-off-by: G Ramalingam <grama@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments