Skip to content

Commit c61567a

Browse files
committed
Fix operator attribute visualization bug
1 parent 589b726 commit c61567a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

visualdl/component/graph/graph_component.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,13 @@ def get_sub_ops(op, op_name, all_ops, all_vars):
474474
all_ops[sub_op_name]['output_vars'][now_var] = [now_var]
475475

476476
try:
477-
attrs = op.results()[0].get_defining_op().attrs()
477+
attrs = sub_op.results()[0].get_defining_op().attrs()
478478
if 'place' in attrs:
479479
attrs['place'] = str(attrs['place'])
480-
attrs['dtype'] = safe_get_dtype(op)
480+
attrs['dtype'] = safe_get_dtype(sub_op)
481481
except Exception:
482-
# attrs = {}
483-
pass
482+
attrs = {}
483+
#pass
484484

485485
all_ops[sub_op_name]['attrs'] = attrs
486486
all_ops[sub_op_name]['attr_types'] = attrs
@@ -601,7 +601,8 @@ def analyse_pir(program):
601601
attrs['place'] = str(attrs['place'])
602602
attrs['dtype'] = safe_get_dtype(op)
603603
except Exception:
604-
pass
604+
#pass
605+
attrs = {}
605606

606607
all_vars[var_name]['shape'] = safe_get_shape(op)
607608
all_vars[var_name]['type'] = safe_get_type(op)
@@ -641,6 +642,15 @@ def analyse_pir(program):
641642
all_vars[now_var]['from_node'] = op_name
642643
all_ops[op_name]['output_vars'][now_var] = [now_var]
643644

645+
try:
646+
attrs = op.results()[0].get_defining_op().attrs()
647+
if 'place' in attrs:
648+
attrs['place'] = str(attrs['place'])
649+
attrs['dtype'] = safe_get_dtype(op)
650+
except Exception:
651+
#pass
652+
attrs = {}
653+
644654
all_ops[op_name]['attrs'] = attrs
645655
all_ops[op_name]['attr_types'] = attrs
646656
all_ops[op_name]['children_node'] = []

0 commit comments

Comments
 (0)