Skip to content

Commit ed4a4b6

Browse files
committed
add doc_string
1 parent 5cbe8e5 commit ed4a4b6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

onnx_array_api/plotting/text_plot.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,15 @@ def str_node(indent, node):
864864
else:
865865
content = ""
866866
line_name_new[init.name] = len(rows)
867+
if init.doc_string:
868+
rows.append(
869+
f"init: name={init.name!r} type={_get_type(init)} "
870+
f"shape={_get_shape(init)}{content} -- {init.doc_string}"
871+
)
872+
continue
867873
rows.append(
868-
"init: name=%r type=%r shape=%r%s"
869-
% (init.name, _get_type(init), _get_shape(init), content)
874+
f"init: name={init.name!r} type={_get_type(init)} "
875+
f"shape={_get_shape(init)}{content}"
870876
)
871877
if level == 0:
872878
rows.append("----- main graph ----")
@@ -1109,10 +1115,18 @@ def onnx_text_plot_io(model, verbose=False, att_display=None):
11091115
)
11101116
# initializer
11111117
for init in model.initializer:
1118+
1119+
if init.doc_string:
1120+
rows.append(
1121+
f"init: name={init.name!r} type={_get_type(init)} "
1122+
f"shape={_get_shape(init)} -- {init.doc_string}"
1123+
)
1124+
continue
11121125
rows.append(
1113-
"init: name=%r type=%r shape=%r"
1114-
% (init.name, _get_type(init), _get_shape(init))
1126+
f"init: name={init.name!r} type={_get_type(init)} "
1127+
f"shape={_get_shape(init)}"
11151128
)
1129+
11161130
# outputs
11171131
for out in model.output:
11181132
rows.append(

0 commit comments

Comments
 (0)