@@ -864,9 +864,15 @@ def str_node(indent, node):
864864else :
865865content = ""
866866line_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
867873rows .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 )
871877if level == 0 :
872878rows .append ("----- main graph ----" )
@@ -1109,10 +1115,18 @@ def onnx_text_plot_io(model, verbose=False, att_display=None):
11091115 )
11101116# initializer
11111117for 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
11121125rows .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
11171131for out in model .output :
11181132rows .append (