Skip to content

Commit da82e42

Browse files
committed
Update prefix naming
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
1 parent 98eaa1f commit da82e42

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

onnxscript/_internal/builder.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,13 +860,16 @@ def call(
860860
# Adapt inputs similarly to call_op: promote constants/tensors to ir.Value.
861861
adapted_args = [self._input_to_ir_value(arg) for arg in args]
862862

863+
count = self.graph.num_nodes()
864+
node_name = self._qualify_node_name(f"{function.name}_node_{count}")
865+
863866
node = ir.node(
864867
op_type=function.name,
865868
inputs=adapted_args,
866869
attributes=kwargs or None,
867870
outputs=output_values,
868871
domain=function.domain,
869-
name=self._qualify_node_name(function.name),
872+
name=node_name,
870873
)
871874
# Attach scope metadata to the node
872875
node.metadata_props["namespace"] = self._build_namespace()
@@ -905,13 +908,14 @@ def call_inline(
905908
for output in graph.outputs:
906909
output_renaming[output.name] = self._qualify_value_name(output.name)
907910

908-
nodes, outputs = _inliner.instantiate(graph, args, kwargs)
909-
910911
if _prefix:
911912
self.push_module(_prefix)
912913

914+
count = self.graph.num_nodes()
915+
node_name_prefix = self._qualify_node_name(f"{function.name}_node_{count}/")
916+
nodes, outputs = _inliner.instantiate(graph, args, kwargs, prefix=node_name_prefix)
917+
913918
for node in nodes:
914-
node.name = self._qualify_node_name(node.name)
915919
for output in node.outputs:
916920
if output.name:
917921
if output.name in output_renaming:

0 commit comments

Comments
 (0)