@@ -824,7 +824,10 @@ def str_node(indent, node):
824824rows .append (f"opset: domain={ opset .domain !r} version={ opset .version !r} " )
825825if hasattr (model ,"graph" ):
826826if model .doc_string :
827- rows .append (f"doc_string:{ model .doc_string } " )
827+ if len (model .doc_string )< 55 :
828+ rows .append (f"doc_string:{ model .doc_string } " )
829+ else :
830+ rows .append (f"doc_string:{ model .doc_string [:55 ]} ..." )
828831main_model = model
829832model = model .graph
830833else :
@@ -861,9 +864,16 @@ def str_node(indent, node):
861864else :
862865content = ""
863866line_name_new [init .name ]= len (rows )
867+ if init .doc_string :
868+ t = (
869+ f"init: name={ init .name !r} type={ _get_type (init )} "
870+ f"shape={ _get_shape (init )} { content } "
871+ )
872+ rows .append (f"{ t } { ' ' * max (0 ,70 - len (t ))} --{ init .doc_string } " )
873+ continue
864874rows .append (
865- "init: name=%r type=%r shape=%r%s "
866- % ( init . name , _get_type ( init ), _get_shape (init ), content )
875+ f "init: name={ init . name !r } type={ _get_type ( init ) } "
876+ f"shape= { _get_shape (init )} { content } "
867877 )
868878if level == 0 :
869879rows .append ("----- main graph ----" )
@@ -1044,7 +1054,10 @@ def _mark_link(rows, lengths, r1, r2, d):
10441054for fct in main_model .functions :
10451055rows .append (f"----- function name={ fct .name } domain={ fct .domain } " )
10461056if fct .doc_string :
1047- rows .append (f"----- doc_string:{ fct .doc_string } " )
1057+ if len (fct .doc_string )< 55 :
1058+ rows .append (f"----- doc_string:{ fct .doc_string } " )
1059+ else :
1060+ rows .append (f"----- doc_string:{ fct .doc_string [:55 ]} ..." )
10481061res = onnx_simple_text_plot (
10491062fct ,
10501063verbose = verbose ,
@@ -1103,10 +1116,19 @@ def onnx_text_plot_io(model, verbose=False, att_display=None):
11031116 )
11041117# initializer
11051118for init in model .initializer :
1119+
1120+ if init .doc_string :
1121+ t = (
1122+ f"init: name={ init .name !r} type={ _get_type (init )} "
1123+ f"shape={ _get_shape (init )} "
1124+ )
1125+ rows .append (f"{ t } { ' ' * max (0 ,70 - len (t ))} --{ init .doc_string } " )
1126+ continue
11061127rows .append (
1107- "init: name=%r type=%r shape=%r "
1108- % ( init . name , _get_type ( init ), _get_shape (init ))
1128+ f "init: name={ init . name !r } type={ _get_type ( init ) } "
1129+ f"shape= { _get_shape (init )} "
11091130 )
1131+
11101132# outputs
11111133for out in model .output :
11121134rows .append (