Skip to content

Commit

Permalink
Fix operator attribute visualization bug (#1287)
Browse files Browse the repository at this point in the history
* Fix wasm-pack not found error

* add parameters --modelfile

* Fix operator attribute visualization bug
  • Loading branch information
cse0001 authored Dec 11, 2024
1 parent f5d81dd commit 85b7887
Showing 1 changed file with 15 additions and 5 deletions.
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

0 comments on commit 85b7887

Please sign in to comment.