diff --git a/tools/model_explorer_circle/src/circle_adapter/main.py b/tools/model_explorer_circle/src/circle_adapter/main.py index 3a6c871fa0d..7bd8a9074b3 100644 --- a/tools/model_explorer_circle/src/circle_adapter/main.py +++ b/tools/model_explorer_circle/src/circle_adapter/main.py @@ -104,7 +104,15 @@ def build_graph(self, me_graph: graph_builder.Graph) -> None: for idx, op in enumerate(sub_graph.operators): name = self.opcode_to_name( self.model.operatorCodes[op.opcodeIndex].builtinCode) - me_node = graph_builder.GraphNode(id=f'{idx}', label=name) + # Construct namespace following output tensor's name + output_tensor_id = op.outputs[0] + output_tensor = sub_graph.tensors[output_tensor_id] + ns = output_tensor.name.decode("utf-8") + if '/' in ns: + # Let's take maximum 2 depths of the tensor name + # '/A/B/C/D' becomes 'A/B' + ns = '/'.join(ns.strip('/').split('/')[:2]) + me_node = graph_builder.GraphNode(id=f'{idx}', label=name, namespace=ns) me_graph.nodes.append(me_node) # Connect edges from inputs to this operator node for i, tensor_id in enumerate(op.inputs):