Skip to content

Commit df4f45e

Browse files
committed
improve display
1 parent ed4a4b6 commit df4f45e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

onnx_array_api/array_api/_onnx_common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def asarray(
9393
v = TEagerTensor(va)
9494
elif isinstance(a, float):
9595
v = TEagerTensor(np.array(a, dtype=np.float64))
96+
elif isinstance(a, complex):
97+
v = TEagerTensor(np.array(a, dtype=np.complex128))
9698
elif isinstance(a, bool):
9799
v = TEagerTensor(np.array(a, dtype=np.bool_))
98100
elif isinstance(a, str):

onnx_array_api/plotting/text_plot.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,11 @@ def str_node(indent, node):
865865
content = ""
866866
line_name_new[init.name] = len(rows)
867867
if init.doc_string:
868-
rows.append(
868+
t = (
869869
f"init: name={init.name!r} type={_get_type(init)} "
870-
f"shape={_get_shape(init)}{content} -- {init.doc_string}"
870+
f"shape={_get_shape(init)}{content}"
871871
)
872+
rows.append(f"{t}{' ' * max(0, 70 - len(t))}-- {init.doc_string}")
872873
continue
873874
rows.append(
874875
f"init: name={init.name!r} type={_get_type(init)} "
@@ -1117,10 +1118,11 @@ def onnx_text_plot_io(model, verbose=False, att_display=None):
11171118
for init in model.initializer:
11181119

11191120
if init.doc_string:
1120-
rows.append(
1121+
t = (
11211122
f"init: name={init.name!r} type={_get_type(init)} "
1122-
f"shape={_get_shape(init)} -- {init.doc_string}"
1123+
f"shape={_get_shape(init)}"
11231124
)
1125+
rows.append(f"{t}{' ' * max(0, 70 - len(t))}-- {init.doc_string}")
11241126
continue
11251127
rows.append(
11261128
f"init: name={init.name!r} type={_get_type(init)} "

0 commit comments

Comments
 (0)