Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix operator attribute visualization bug #1287

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions visualdl/component/graph/graph_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,13 @@ def get_sub_ops(op, op_name, all_ops, all_vars):
all_ops[sub_op_name]['output_vars'][now_var] = [now_var]

try:
attrs = op.results()[0].get_defining_op().attrs()
attrs = sub_op.results()[0].get_defining_op().attrs()
if 'place' in attrs:
attrs['place'] = str(attrs['place'])
attrs['dtype'] = safe_get_dtype(op)
attrs['dtype'] = safe_get_dtype(sub_op)
except Exception:
# attrs = {}
pass
attrs = {}
#pass

all_ops[sub_op_name]['attrs'] = attrs
all_ops[sub_op_name]['attr_types'] = attrs
Expand Down Expand Up @@ -601,7 +601,8 @@ def analyse_pir(program):
attrs['place'] = str(attrs['place'])
attrs['dtype'] = safe_get_dtype(op)
except Exception:
pass
#pass
attrs = {}

all_vars[var_name]['shape'] = safe_get_shape(op)
all_vars[var_name]['type'] = safe_get_type(op)
Expand Down Expand Up @@ -641,6 +642,15 @@ def analyse_pir(program):
all_vars[now_var]['from_node'] = op_name
all_ops[op_name]['output_vars'][now_var] = [now_var]

try:
attrs = op.results()[0].get_defining_op().attrs()
if 'place' in attrs:
attrs['place'] = str(attrs['place'])
attrs['dtype'] = safe_get_dtype(op)
except Exception:
#pass
attrs = {}

all_ops[op_name]['attrs'] = attrs
all_ops[op_name]['attr_types'] = attrs
all_ops[op_name]['children_node'] = []
Expand Down
Loading