Graphviz轻松画神经网络图

推荐教程学习Graphviz绘图
下载戳官网
尝试画了个RNN的图,效果如下:

Graphviz轻松画神经网络图_第1张图片
RNN结构图

代码如下:

digraph ""
   {
   color=white; 
   labelloc = "b";
   #node[color="#FF6347"]
   edge[penwidth="1"]
    
   node [shape=plaintext];
   n001 [label="Input Layer"];
   n002 [label="Hidden Layer"];
   n004 [label="Output Layer"];
   n001 -> n002;
   n002 -> n004;

   node  [shape=record, label=" | | | | | ...|  ",height=".3",penwidth=".8"];
   n01 [label="x(t-1)", fillcolor="#CCE5FF", style=filled] ;
   n02 [label="x(t)", fillcolor="#CCE5FF", style=filled] ;
   node [shape=Mrecord, label=" | | | | | ...|  ",height=".3"];
   n03 [label="...", fillcolor="#FFE6CC", style=filled] ;
   n04 [label="h(t-1)", fillcolor="#FFE6CC", style=filled] ;
   n05 [label="h(t)", fillcolor="#FFE6CC", style=filled] ;
   n08 [label="...", fillcolor="#FFE6CC", style=filled] ;
   node  [shape=record, label=" | | | | | ...|  ",height=".3"];
   n06 [label="o(t-1)", fillcolor="#CCE5FF", style=filled] ;
   n07 [label="o(t)", fillcolor="#CCE5FF", style=filled] ;

   n01 -> n04 [label="U"] ;
   n03 -> n04 [label="W"] ;
   n02 -> n05 [label="U"];
   n04 -> n05 [label="W"];
   n04 -> n06 [label="V"];
   n05 -> n07 [label="V"];
   n05 -> n08 [label="W"];
   {rank=same; n001 n01 n02}
   {rank=same; n002 n03 n04 n05 n08}
   {rank=same; n004 n06 n07}
   }


你可能感兴趣的:(Graphviz轻松画神经网络图)