Commit f0dd831a by 孟霞

14许诺的反馈

parent 7f9d37b8
......@@ -11,7 +11,7 @@
\node [anchor=north west,snode,minimum width=5.8em] (s5) at ([yshift=-0.3em]s4.south west) {\tiny{}};
\node [anchor=north west,snode,minimum width=3em] (s6) at ([yshift=-0.3em]s5.south west) {\tiny{}};
\node [anchor=east] (label1) at ([xshift=-0.8em,yshift=0.6em]s1.west) {{句子:}};
\node [anchor=east] (label1) at ([xshift=-0.8em,yshift=-2em]s1.west) {{句子:}};
\node [anchor=west,pnode,minimum width=3em] (p1) at ([xshift=0.3em]s1.east) {\tiny{}};
\node [anchor=west,pnode,minimum width=4em] (p3) at ([xshift=0.3em]s3.east) {\tiny{}};
\node [anchor=west,pnode,minimum width=0.5em] (p4) at ([xshift=0.3em]s4.east) {\tiny{}};
......@@ -29,7 +29,7 @@
\node [anchor=north west,snode,minimum width=5.8em] (sbi5) at ([yshift=-0.3em]sbi4.south west) {\tiny{}};
\node [anchor=north west,snode,minimum width=3em] (sbi6) at ([yshift=-0.3em]sbi5.south west) {\tiny{}};
\node [anchor=east] (label1) at ([xshift=-0.8em,yshift=-1em]sbi1.west) {{batch}};
\node [anchor=east] (label1) at ([xshift=-0.8em,yshift=-1em]sbi1.west) {{批次}};
\node [anchor=west,pnode,minimum width=3em] (pbi1) at ([xshift=0.3em]sbi1.east) {\tiny{}};
\node [anchor=west,pnode,minimum width=4em] (pbi3) at ([xshift=0.3em]sbi3.east) {\tiny{}};
\node [anchor=west,pnode,minimum width=0.5em] (pbi4) at ([xshift=0.3em]sbi4.east) {\tiny{}};
......@@ -43,7 +43,7 @@
\node [anchor=north west,snode,minimum width=5.8em] (sma2) at ([yshift=-0.3em]sma1.south west) {\tiny{}};
\node [anchor=north west,snode,minimum width=6.3em] (sma3) at ([yshift=-0.3em]sma2.south west) {\tiny{}};
\node [anchor=east] (label1) at ([xshift=-0.8em,yshift=-2em]sma1.west) {{batch}};
\node [anchor=east] (label1) at ([xshift=-0.8em,yshift=-2em]sma1.west) {{批次}};
\node [anchor=west,pnode,minimum width=0.5em] (pma1) at ([xshift=0.3em]sma1.east) {\tiny{}};
\node [anchor=west,pnode,minimum width=0.2em] (pma2) at ([xshift=0.3em]sma2.east) {\tiny{}};
......
......@@ -2,14 +2,14 @@
\definecolor{babyblueeyes}{rgb}{0.63, 0.79, 0.95}
\tikzstyle{er} = [rectangle,minimum width=2.5cm,minimum height=1.5cm,rounded corners,text centered,draw=taupegray,drop shadow]
\tikzstyle{er} = [rectangle,minimum width=2.5cm,minimum height=1.5cm,rounded corners,text centered,draw,drop shadow]
\begin{tikzpicture}[node distance = 0,scale = 0.75]
\tikzstyle{every node}=[scale=0.75]
\node (encoder)[er,very thick,draw=taupegray,fill=ugreen!20]{\Large{编码器}};
\node (decoder_1)[er,very thick,draw=taupegray,right of=encoder,xshift=4cm,fill=red!20]{\Large{解码器}};
\node (decoder_2)[er,very thick,draw=taupegray,right of=decoder_1,xshift=4cm,fill=red!20]{\Large{解码器}};
\node (encoder)[er,thick,draw,fill=ugreen!20]{\Large{编码器}};
\node (decoder_1)[er,thick,draw,right of=encoder,xshift=4cm,fill=red!20]{\Large{解码器}};
\node (decoder_2)[er,thick,draw,right of=decoder_1,xshift=4cm,fill=red!20]{\Large{解码器}};
\node (point)[right of=decoder_2,xshift=2.5cm,]{\LARGE{...}};
\node (decoder_3)[er,very thick,draw=taupegray,right of=point,xshift=2.5cm,fill=red!20]{\Large{解码器}};
\node (decoder_3)[er,thick,draw,right of=point,xshift=2.5cm,fill=red!20]{\Large{解码器}};
\draw [->,very thick,draw=black!70]([xshift=0.2cm]encoder.east) -- ([xshift=-0.2cm]decoder_1.west);
\draw [->,very thick,draw=black!70]([xshift=0.2cm]decoder_1.east) -- ([xshift=-0.2cm]decoder_2.west);
\draw [->,very thick,draw=black!70]([xshift=0.2cm]decoder_2.east) -- ([xshift=-0.1cm]point.west);
......@@ -23,17 +23,17 @@
\draw [->,very thick,draw=black!70]([xshift=0,yshift=-1cm]decoder_1.south) -- ([xshift=0,yshift=-0.2cm]decoder_1.south);
\draw [->,very thick,draw=black!70]([xshift=0,yshift=0.2cm]decoder_1.north) -- ([xshift=0,yshift=1cm]decoder_1.north);
\node [below of = decoder_1,xshift=0cm,yshift=-2.2cm]{\Large$x'$};
\node (line1_1)[below of = decoder_1,xshift=0cm,yshift=2.2cm]{\Large$y_1$};
\node (line1_1)[below of = decoder_1,xshift=0cm,yshift=2.2cm]{\Large$y'$};
\draw [->,thick,]([xshift=0,yshift=-1cm]decoder_2.south) -- ([xshift=0,yshift=-0.2cm]decoder_2.south);
\draw [->,very thick,draw=black!70]([xshift=0,yshift=0.2cm]decoder_2.north) -- ([xshift=0,yshift=1cm]decoder_2.north);
\node (line1_2)[below of = decoder_2,xshift=0cm,yshift=-2.2cm]{\Large$y_1$};
\node [below of = decoder_2,xshift=0cm,yshift=2.2cm]{\Large$y_2$};
\node (line1_2)[below of = decoder_2,xshift=0cm,yshift=-2.2cm]{\Large$y'$};
\node [below of = decoder_2,xshift=0cm,yshift=2.2cm]{\Large$y''$};
\draw [->,very thick,draw=black!70]([xshift=0,yshift=-1cm]decoder_3.south) -- ([xshift=0,yshift=-0.2cm]decoder_3.south);
\draw [->,very thick,draw=black!70]([xshift=0,yshift=0.2cm]decoder_3.north) -- ([xshift=0,yshift=1cm]decoder_3.north);
\node (line3_2)[below of = decoder_3,xshift=0cm,yshift=-2.2cm]{\Large$y_{N-1}$};
\node [below of = decoder_3,xshift=0cm,yshift=2.2cm]{\Large$y_N$};
\node (line3_2)[below of = decoder_3,xshift=0cm,yshift=-2.2cm]{\Large$y^{N-1}$};
\node [below of = decoder_3,xshift=0cm,yshift=2.2cm]{\Large$y^N$};
\draw[->,very thick,draw=black!70, out=0, in=180,dotted] (line1_1.east) to (line1_2.west);
\draw[->,very thick,draw=black!70, out=0, in=180,dotted] ([xshift=4cm]line1_1.east) to ([xshift=3cm]line1_2.west);
......
......@@ -5,8 +5,8 @@
\node [anchor=south] (text) at ([xshift=0.5em,yshift=-3.5em]part1.south) {\scriptsize{源语言句子(编码器输出)}};
\node [anchor=east,draw=black!70,rounded corners,drop shadow,very thick,minimum width=6em,minimum height=3.5em,fill=blue!15,align=center,text=black] (part2) at ([xshift=10em]part1.east) {\scriptsize{搜索模块}};
\node [anchor=south] (text1) at ([xshift=0.5em,yshift=2.2em]part1.north) {\scriptsize{译文中已经生成的单词}};
\node [anchor=south] (text2) at ([xshift=0.5em,yshift=2.2em]part2.north) {\scriptsize{预测当前位置的单词分布}};
\node [anchor=south] (text1) at ([xshift=0.1em,yshift=2.2em]part1.north) {\scriptsize{译文中已经生成的单词}};
\node [anchor=south] (text2) at ([xshift=0.5em,yshift=2.2em]part2.north) {\scriptsize{预测当前位置的单词概率分布}};
\draw [->,draw=black, thick] ([yshift=2em]part1.north) -- ([yshift=0.1em]part1.north);
\draw [->,draw=black, thick] ([yshift=-2em]part1.south) -- ([yshift=-0.1em]part1.south);
......
\definecolor{taupegray}{rgb}{0.55, 0.52, 0.54}
\tikzstyle{er} = [rectangle,minimum width=7cm,minimum height=2.5cm,text centered,draw=taupegray,drop shadow,rounded corners]
\tikzstyle{er} = [rectangle,minimum width=7cm,minimum height=2.5cm,text centered,draw,drop shadow,rounded corners]
\begin{tikzpicture}[node distance = 0,scale = 0.55]
\tikzstyle{every node}=[scale=0.55]
\node (encoder)[er,very thick,minimum width=5.5cm,fill=ugreen!20]{\huge{编码器}};
\node (decoder)[er,very thick,right of=encoder,xshift=7.75cm,fill=red!20]{\huge{解码器}};
\node (decoder_1)[er,very thick,right of=decoder,xshift=8.75cm,fill=red!20]{\huge{解码器}};
\node (encoder)[er,thick,minimum width=5.5cm,fill=ugreen!20]{\huge{编码器}};
\node (decoder)[er,thick,right of=encoder,xshift=7.75cm,fill=red!20]{\huge{解码器}};
\node (decoder_1)[er,thick,right of=decoder,xshift=8.75cm,fill=red!20]{\huge{解码器}};
\draw [->,very thick,draw=black!70]([xshift=0.2cm]encoder.east) -- ([xshift=-0.2cm]decoder.west);
\draw [->,very thick,draw=black!70]([xshift=0.2cm]decoder.east) -- ([xshift=-0.2cm]decoder_1.west);
\foreach \x in {-2.2cm,-1.1cm,...,2.2cm}
\draw [->,very thick,draw=black!70]([xshift=\x,yshift=-1cm]encoder.south) -- ([xshift=\x,yshift=-0.2cm]encoder.south);
\node [below of = encoder,xshift=-2.3cm,yshift=-2.95cm,scale=1.2]{\large{[LEN]}};
\node [below of = encoder,xshift=-1.05cm,yshift=-2.9cm,scale=1.2]{\large{hello}};
\node [below of = encoder,xshift=-2.3cm,yshift=-2.95cm,scale=1.2]{\large{<LEN>}};
\node [below of = encoder,xshift=-1cm,yshift=-2.9cm,scale=1.2]{\large{hello}};
\node [below of = encoder,xshift=0cm,yshift=-3.05cm,scale=1.2]{,};
\node [below of = encoder,xshift=1.1cm,yshift=-2.9cm,scale=1.2]{\large{world}};
\node [below of = encoder,xshift=2.2cm,yshift=-2.9cm,scale=1.2]{!};
......@@ -22,14 +22,14 @@
\foreach \x in {-2.7cm,-0.9cm,...,2.8cm}
{\draw [->,very thick,draw=black!70]([xshift=\x,yshift=-1cm]decoder.south) -- ([xshift=\x,yshift=-0.2cm]decoder.south);
\draw [->,very thick,draw=black!70]([xshift=\x,yshift=0.2cm]decoder.north) -- ([xshift=\x,yshift=1cm]decoder.north);}
\node [below of = decoder,xshift=-2.7cm,yshift=-2.9cm,scale=1.6]{\small{[Mask]}};
\node [below of = decoder,xshift=-0.9cm,yshift=-2.9cm,scale=1.6]{\small{[Mask]}};
\node [below of = decoder,xshift=0.9cm,yshift=-2.9cm,scale=1.6]{\small{[Mask]}};
\node [below of = decoder,xshift=2.7cm,yshift=-2.9cm,scale=1.6]{\small{[Mask]}};
\node [below of = decoder,xshift=-2.7cm,yshift=2.9cm,scale=1.6]{你好};
\node [below of = decoder,xshift=-0.9cm,yshift=2.7cm,scale=1.6]{};
\node [below of = decoder,xshift=0.9cm,yshift=2.9cm,scale=1.6]{你好};
\node [below of = decoder,xshift=2.6cm,yshift=2.9cm,scale=1.6]{};
\node [below of = decoder,xshift=-3cm,yshift=-2.9cm,scale=1.6]{\small{<Mask>}};
\node [below of = decoder,xshift=-1cm,yshift=-2.9cm,scale=1.6]{\small{<Mask>}};
\node [below of = decoder,xshift=1cm,yshift=-2.9cm,scale=1.6]{\small{<Mask>}};
\node [below of = decoder,xshift=3cm,yshift=-2.9cm,scale=1.6]{\small{<Mask>}};
\node [below of = decoder,xshift=-3cm,yshift=2.9cm,scale=1.6]{你好};
\node [below of = decoder,xshift=-1cm,yshift=2.7cm,scale=1.6]{};
\node [below of = decoder,xshift=1cm,yshift=2.9cm,scale=1.6]{你好};
\node [below of = decoder,xshift=2.9cm,yshift=2.9cm,scale=1.6]{};
\foreach \x in {-2.7cm,-0.9cm,...,2.8cm}
......@@ -42,7 +42,7 @@
\node [below of = decoder_1,xshift=-2.7cm,yshift=-2.9cm,scale=1.6]{你好};
\node [below of = decoder_1,xshift=-0.9cm,yshift=-3cm,scale=1.6]{};
\node [below of = decoder_1,xshift=0.9cm,yshift=-2.9cm,scale=1.6]{\small{[Mask]}};
\node [below of = decoder_1,xshift=0.9cm,yshift=-2.9cm,scale=1.6]{\small{<Mask>}};
\node [below of = decoder_1,xshift=2.7cm,yshift=-2.9cm,scale=1.6]{};
......
......@@ -16,9 +16,9 @@
\node[anchor=north,word] (en4) at ([yshift=-1.3em,xshift=3em]encoder.south) {};
\node[anchor=north,word] (de1) at ([yshift=-1.3em,xshift=-4em]decoder.south) {1};
\node[anchor=north,word] (de1) at ([yshift=-1.3em,xshift=-5.2em]decoder.south) {1};
\node[anchor=north,word] (de2) at ([yshift=-1.3em]decoder.south) {2};
\node[anchor=north,word] (de3) at ([yshift=-1.3em,xshift=4em]decoder.south) {3};
\node[anchor=north,word] (de3) at ([yshift=-1.3em,xshift=5em]decoder.south) {3};
\node[p,anchor=south, minimum height=0.5em] (w1_1) at ([xshift=-7em,yshift=1.5em]decoder.north){};
\node[p,anchor=south,minimum height=2em] (w1_2) at ([xshift=0.3em]w1_1.south east){};
......@@ -47,11 +47,11 @@
\node[p,anchor=south,minimum height=0.4em] (w3_7) at ([xshift=0.3em]w3_6.south east){};
\node[p,anchor=south,minimum height=0.6em] (w3_8) at ([xshift=0.3em]w3_7.south east){};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.3em]w1_2.north){Good};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.3em]w1_6.north){Well};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.3em]w2_2.north){job};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.3em]w2_5.north){done};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.3em]w3_4.north){!};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.4em]w1_2.north){Good};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.5em]w1_6.north){Well};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.35em]w2_2.north){job};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.55em]w2_5.north){done};
\node[inner sep=0pt,font=\scriptsize] at ([yshift=0.45em]w3_4.north){!};
\draw[->, thick] ([yshift=0.1em]en1.north) -- ([xshift=-3em,yshift=-0.1em]encoder.south);
......@@ -59,9 +59,9 @@
\draw[->, thick] ([yshift=0.1em]en3.north) -- ([xshift=1em,yshift=-0.1em]encoder.south);
\draw[->, thick] ([yshift=0.1em]en4.north) -- ([xshift=3em,yshift=-0.1em]encoder.south);
\draw[->, thick] ([yshift=0.1em]de1.north) -- ([xshift=-4em,yshift=-0.1em]decoder.south);
\draw[->, thick] ([yshift=0.1em]de1.north) -- ([xshift=-5.2em,yshift=-0.1em]decoder.south);
\draw[->, thick] ([yshift=0.1em]de2.north) -- ([xshift=0em,yshift=-0.1em]decoder.south);
\draw[->, thick] ([yshift=0.1em]de3.north) -- ([xshift=4em,yshift=-0.1em]decoder.south);
\draw[->, thick] ([yshift=0.1em]de3.north) -- ([xshift=5em,yshift=-0.1em]decoder.south);
\draw[->, line width=1.5pt] (encoder.east) -- (decoder.west);
......@@ -77,10 +77,10 @@
\draw[->, thick] ([yshift=-1.2em]box2.south) -- (box2.south);
\draw[->, thick] ([yshift=-1.2em]box3.south) -- (box3.south);
\node[tgt,anchor=west,align=left] (tgt1) at ([xshift=2em]box3.east) {Good job!};
\node[tgt,,anchor=north,align=left](tgt2) at ([yshift=-1em]tgt1.south) {Well done!};
\node[tgt,,anchor=north,align=left] (tgt3) at ([yshift=-1em]tgt2.south) {Good done!};
\node[tgt,,anchor=north,align=left] (tgt4) at ([yshift=-1em]tgt3.south) {Well job!};
\node[tgt,anchor=west,align=left] (tgt1) at ([xshift=2em]box3.east) {Good job !};
\node[tgt,,anchor=north,align=left](tgt2) at ([yshift=-1em]tgt1.south) {Well done !};
\node[tgt,,anchor=north,align=left] (tgt3) at ([yshift=-1em]tgt2.south) {Good done !};
\node[tgt,,anchor=north,align=left] (tgt4) at ([yshift=-1em]tgt3.south) {Well job !};
\node[text=ugreen] at ([xshift=1em]tgt1.east){\ding{51}};
\node[text=ugreen] at ([xshift=1em]tgt2.east){\ding{51}};
\node[text=red] at ([xshift=1em]tgt3.east){\ding{55}};
......
......@@ -11,12 +11,12 @@
\node[layer,fill=red!15] (src_emb) at (0,0){\scriptsize\textbf{Input Embedding}};
\node[anchor=south,layer,fill=yellow!20] (src_sa) at ([yshift=3.7em]src_emb.north){\scriptsize\textbf{Self-attention}};
\node[anchor=south,layer,fill=orange!20] (src_ff) at ([yshift=1em]src_sa.north){\scriptsize\textbf{Feed Forward}};
\node[anchor=south,layer,fill=blue!20] (src_sf) at ([yshift=2.4em]src_ff.north){\scriptsize\textbf{Softmax}};
\node[anchor=south,layer,fill=blue!20] (src_sf) at ([yshift=2.6em]src_ff.north){\scriptsize\textbf{Softmax}};
%decoder
\node[anchor=west,layer,fill=red!15] (tgt_emb) at ([xshift=4.4em]src_emb.east){\scriptsize\textbf{Output Embedding}};
\node[anchor=south,layer,fill=yellow!20] (tgt_sa) at ([yshift=3.7em]tgt_emb.north){\scriptsize\textbf{Self-attention}};
\node[anchor=south,layer,fill=yellow!20] (tgt_pa) at ([yshift=1.1em]tgt_sa.north){\scriptsize\textbf{Positional Attention}};
\node[anchor=south,layer,fill=yellow!20] (tgt_pa) at ([yshift=1.5em]tgt_sa.north){\scriptsize\textbf{Positional Attention}};
\node[anchor=south,layer,fill=yellow!20] (tgt_eda) at ([yshift=1.5em]tgt_pa.north){\scriptsize\textbf{Encoder-Decoder} \\ \scriptsize\textbf{Attention}};
\node[anchor=south,layer,fill=orange!20] (tgt_ff) at ([yshift=1em]tgt_eda.north){\scriptsize\textbf{Feed Forward}};
\node[anchor=south,layer,fill=green!20] (tgt_linear) at ([yshift=1.4em]tgt_ff.north){\scriptsize\textbf{Linear}};
......@@ -36,6 +36,11 @@
\node[cir] (tgt_add) at (12em,2.5em) {};
\node[cir,fill=orange!7] (tgt_pos) at (14.5em,2.5em) {};
\node[cir,fill=orange!7] (tgt_pos2) at ([xshift=4.5em,yshift=-2.45em]tgt_pa.north) {};
\draw[line,rounded corners=2pt] (tgt_pos2.180) -- ([yshift=-0.8em]tgt_pa.south) -- (tgt_pa.south);
\draw[line,rounded corners=2pt] (tgt_pos2.180) -- ([xshift=1.8em,yshift=-0.8em]tgt_pa.south) -- ([xshift=1.8em]tgt_pa.south);
\draw[-,thick,] (tgt_pos2.180) .. controls ([xshift=0.8em,yshift=0.8em]tgt_pos2.180) and ([xshift=-0.8em,yshift=-0.8em]tgt_pos2.0) ..(tgt_pos2.0);
\draw[line,rounded corners=2pt] (tgt_sa.north) -- ([yshift=0.5em]tgt_sa.north) -- ([xshift=-1.8em,yshift=0.5em]tgt_sa.north)--([xshift=-1.8em]tgt_pa.south);
\draw[-,thick] (src_add.90) -- (src_add.-90);
\draw[-,thick] (src_add.0) -- (src_add.180);
......@@ -50,7 +55,6 @@
\draw[line] (src_ff.north) -- (src_sf.south);
\draw[line] (tgt_emb.north) -- (tgt_add.south);
\draw[line] (tgt_add.north) -- (tgt_sa.south);
\draw[line] (tgt_sa.north) -- (tgt_pa.south);
\draw[line] (tgt_eda.north) -- (tgt_ff.south);
\draw[line] (tgt_ff.north) -- (tgt_linear.south);
\draw[line] (tgt_linear.north) -- (tgt_sf.south);
......@@ -60,28 +64,27 @@
\draw[line] (tgt_sf.north) -- (output.south);
\draw[line] (src.north) -- (src_emb.south);
\draw[line,<->,out=-35,in=-145] ([xshift=-2em]src_sa.south) to ([xshift=2em]src_sa.south);
\draw[line, rounded corners=2pt] (src_ff.north) -- ([yshift=0.9em]src_ff.north) -- ([xshift=-2.4em,yshift=-0.8em]tgt_eda.south) -- ([xshift=-2.4em]tgt_eda.south);
\draw[line, rounded corners=2pt] (src_ff.north) -- ([yshift=0.9em]src_ff.north) -- ([yshift=-0.8em]tgt_eda.south) -- (tgt_eda.south);
\draw[line, rounded corners=2pt] (src_ff.north) -- ([yshift=1.1em]src_ff.north) -- ([xshift=-2.4em,yshift=-0.8em]tgt_eda.south) -- ([xshift=-2.4em]tgt_eda.south);
\draw[line, rounded corners=2pt] (src_ff.north) -- ([yshift=1.1em]src_ff.north) -- ([yshift=-0.8em]tgt_eda.south) -- (tgt_eda.south);
\draw[line, rounded corners=2pt] (tgt_pa.north) -- ([yshift=0.5em]tgt_pa.north) -- ([yshift=0.5em,xshift=2.4em]tgt_pa.north) -- ([xshift=2.4em]tgt_eda.south);
\draw[line,<->,out=-35,in=-145] ([xshift=-2em]tgt_sa.south) to ([xshift=2em]tgt_sa.south);
\draw[line,<->,out=-35,in=-145] ([xshift=-2em]tgt_pa.south) to ([xshift=2em]tgt_pa.south);
\begin{pgfonlayer}{background}
{
\node[draw=taupegray,thick,fill=ugreen!10,inner sep=0pt,minimum height=6.7em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box1) at (0em,6.8em){};
\node[draw=taupegray,thick,fill=yellow!10,inner sep=0pt,minimum height=4.5em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box2) at (0em,13em){};
\node[draw=taupegray,thick,fill=blue!7,inner sep=0pt,minimum height=13.3em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box3) at (12em,10.1em){};
\node[draw=taupegray,thick,fill=ugreen!10,inner sep=0pt,minimum height=7em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box1) at (0em,6.9em){};
\node[draw=taupegray,thick,fill=yellow!10,inner sep=0pt,minimum height=4.5em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box2) at (0em,13.2em){};
\node[draw=taupegray,thick,fill=blue!7,inner sep=0pt,minimum height=13.3em,minimum width=10.5em,rounded corners=4pt,drop shadow] (box3) at (12em,10.1em){};
}
\end{pgfonlayer}
\node[] at ([yshift=1.8em]box2.north){\normalsize{译文长度:5}};
\node[] at ([xshift=-2em,yshift=0.5em]box2.west){\normalsize{繁衍率}};
\node[] at ([xshift=-2em,yshift=-0.5em]box2.west){\normalsize{预测器}};
\node[] at ([xshift=-2em]box1.west){\normalsize{编码器}};
\node[] at ([xshift=-1em,yshift=-2.5em]box1.west){{$M \times$}};
\node[] at ([xshift=-1em,yshift=-2.7em]box1.west){{$M \times$}};
\node[] at ([xshift=2em]box3.east){\normalsize{解码器}};
\node[] at ([xshift=1em,yshift=-6em]box3.east){{$\times N$}};
\draw[line,dotted,rounded corners=4pt,violet] (box2.north) -- ([yshift=1em]box2.north) -- ([yshift=1em,xshift=6.2em]box2.north) -- ([xshift=-2.2em]tgt_emb.west) -- (tgt_emb.west);
\draw[line,dotted,rounded corners=4pt,violet] (box2.north) -- ([yshift=1em]box2.north) -- ([yshift=1em,xshift=5.8em]box2.north) -- ([xshift=-2.35em]tgt_emb.west) -- (tgt_emb.west);
\draw[line,-,dotted,rounded corners=4pt,violet,] (src_emb.east) -- ([xshift=-2em]tgt_emb.west);
\end{tikzpicture}
......
\definecolor{taupegray}{rgb}{0.55, 0.52, 0.54}
\definecolor{bananamania}{rgb}{0.98, 0.91, 0.71}
%%% outline
%-------------------------------------------------------------------------
\begin{tikzpicture}
\tikzstyle{every node}=[scale=0.7]
\tikzstyle{layer} = [draw=black!70,thick, minimum width=7.5em,rounded corners=2pt,inner ysep=6pt,font=\footnotesize,align=center]
\tikzstyle{line} = [line width=1pt,->]
\tikzstyle{cir} = [draw,circle,minimum size=1em, thick,inner sep=0pt]
%encoder
\node[layer,fill=red!15] (src_emb) at (0,0){\scriptsize\textbf{Input Embedding}};
\node[anchor=south,layer,fill=yellow!20] (src_sa) at ([yshift=2.8em]src_emb.north){\scriptsize\textbf{Self-Attention}};
\node[anchor=south,layer,fill=gray!20] (src_norm1) at ([yshift=0.6em]src_sa.north){\scriptsize\textbf{Add \& LayerNorm}};
\node[anchor=south,layer,fill=orange!20] (src_ff) at ([yshift=0.6em]src_norm1.north){\scriptsize\textbf{Feed Forward}\\ \scriptsize\textbf{Network}};
\node[anchor=south,layer,fill=gray!20] (src_norm2) at ([yshift=0.6em]src_ff.north){\scriptsize\textbf{Add \& LayerNorm}};
\node[anchor=south,layer,fill=blue!20] (src_sf) at ([yshift=1.6em]src_norm2.north){\scriptsize\textbf{Softmax}};
%decoder
\node[anchor=west,layer,fill=red!15] (tgt_emb) at ([xshift=4.4em]src_emb.east){\scriptsize\textbf{Output Embedding}};
\node[anchor=south,layer,fill=yellow!20] (tgt_sa) at ([yshift=2.8em]tgt_emb.north){\scriptsize\textbf{Self-Attention}};
\node[anchor=south,layer,fill=yellow!20] (tgt_pa) at ([yshift=1.4em]tgt_sa.north){\scriptsize\textbf{Positional Attention}};
\node[anchor=south,layer,fill=gray!20] (tgt_norm1) at ([yshift=0.6em]tgt_pa.north){\scriptsize\textbf{Add \& LayerNorm}};
\node[anchor=south,layer,fill=yellow!20] (tgt_eda) at ([yshift=1.4em]tgt_norm1.north){\scriptsize\textbf{Encoder-Decoder} \\ \scriptsize\textbf{Attention}};
\node[anchor=south,layer,fill=gray!20] (tgt_norm2) at ([yshift=0.6em]tgt_eda.north){\scriptsize\textbf{Add \& LayerNorm}};
\node[anchor=south,layer,fill=orange!20] (tgt_ff) at ([yshift=0.6em]tgt_norm2.north){\scriptsize\textbf{Feed Forward}\\ \scriptsize\textbf{Network}};
\node[anchor=south,layer,fill=gray!20] (tgt_norm3) at ([yshift=0.6em]tgt_ff.north){\scriptsize\textbf{Add \& LayerNorm}};
\node[anchor=south,layer,fill=green!20] (tgt_linear) at ([yshift=1.1em]tgt_norm3.north){\scriptsize\textbf{Linear}};
\node[anchor=south,layer,fill=blue!20] (tgt_sf) at ([yshift=0.6em]tgt_linear.north){\scriptsize\textbf{Softmax}};
\node[font=\footnotesize,anchor=south] (w3) at ([yshift=0.8em]src_sf.north){\scriptsize\textbf{2}};
\node[font=\footnotesize,anchor=east] (w2) at ([xshift=-0.5em]w3.west){\scriptsize\textbf{1}};
\node[font=\footnotesize,anchor=east] (w1) at ([xshift=-0.5em]w2.west){\scriptsize\textbf{1}};
\node[font=\footnotesize,anchor=west] (w4) at ([xshift=0.5em]w3.east){\scriptsize\textbf{0}};
\node[font=\footnotesize,anchor=west] (w5) at ([xshift=0.5em]w4.east){\scriptsize\textbf{1}};
\node[font=\footnotesize,anchor=south] (output) at ([yshift=0.8em]tgt_sf.north){\scriptsize\sffamily\bfseries{我们\quad 完全\quad 接受\quad\quad}};
\node[font=\footnotesize,anchor=north] (src) at ([yshift=-0.8em]src_emb.south){\scriptsize\textbf{We totally accept it .}};
\node[font=\footnotesize,anchor=north] (tgt) at ([yshift=-0.8em]tgt_emb.south){\scriptsize\textbf{We totally accept accept .}};
\node[cir] (src_add) at (0,1.6em) {};
\node[cir,fill=orange!7] (src_pos) at (-2.5em,1.6em) {};
\node[cir] (tgt_add) at (9.7em,1.6em) {};
\node[cir,fill=orange!7] (tgt_pos) at (12.2em,1.6em) {};
\node[cir,fill=orange!7] (tgt_pos2) at ([xshift=3em,yshift=-1.74em]tgt_pa.north) {};
\draw[line] (tgt_pos2.180) -- ([yshift=-0.6em]tgt_pa.south) -- (tgt_pa.south);
\draw[line] (tgt_pos2.180) -- ([xshift=1.8em,yshift=-0.6em]tgt_pa.south) -- ([xshift=1.8em]tgt_pa.south);
\draw[-,thick] (src_add.90) -- (src_add.-90);
\draw[-,thick] (src_add.0) -- (src_add.180);
\draw[-,thick,] (src_pos.180) .. controls ([xshift=0.8em,yshift=0.8em]src_pos.180) and ([xshift=-0.8em,yshift=-0.8em]src_pos.0) ..(src_pos.0);
\draw[-,thick] (tgt_add.90) -- (tgt_add.-90);
\draw[-,thick] (tgt_add.0) -- (tgt_add.180);
\draw[-,thick,] (tgt_pos.180) .. controls ([xshift=0.8em,yshift=0.8em]tgt_pos.180) and ([xshift=-0.8em,yshift=-0.8em]tgt_pos.0) ..(tgt_pos.0);
\draw[-,thick,] (tgt_pos2.180) .. controls ([xshift=0.8em,yshift=0.8em]tgt_pos2.180) and ([xshift=-0.8em,yshift=-0.8em]tgt_pos2.0) ..(tgt_pos2.0);
\draw[line] (src_emb.north) -- (src_add.south);
\draw[line] (src_add.north) -- (src_sa.south);
\draw[line] (src_sa.north) -- (src_norm1.south);
\draw[line] (src_norm1.north) -- (src_ff.south);
\draw[line] (src_ff.north) -- (src_norm2.south);
\draw[line] (src_norm2.north) -- (src_sf.south);
\draw[line] (tgt_emb.north) -- (tgt_add.south);
\draw[line] (tgt_add.north) -- (tgt_sa.south);
\draw[line] (tgt_sa.north) -- ([yshift=0.5em]tgt_sa.north) -- ([xshift=-1.8em,yshift=0.5em]tgt_sa.north)--([xshift=-1.8em]tgt_pa.south);
\draw[line] (tgt_pa.north) -- (tgt_norm1.south);
\draw[line] (tgt_eda.north) -- (tgt_norm2.south);
\draw[line] (tgt_norm2.north) -- (tgt_ff.south);
\draw[line] (tgt_ff.north) -- (tgt_norm3.south);
\draw[line] (tgt_norm3.north) -- (tgt_linear.south);
\draw[line] (src_pos.0) -- (src_add.180);
\draw[line] (tgt_pos.180) -- (tgt_add.0);
\draw[line] (src_sf.north) -- (w3.south);
\draw[line] (tgt_sf.north) -- (output.south);
\draw[line] (src.north) -- (src_emb.south);
\draw[line,<->,out=-25,in=-155] ([xshift=-2em]src_sa.south) to ([xshift=2em]src_sa.south);
\draw[line] (src_norm2.north) -- ([yshift=0.5em]src_norm2.north) -- ([xshift=4em,yshift=0.5em]src_norm2.north) -- ([xshift=4em,yshift=-0.95em]src_norm2.north) -- ([xshift=-1.8em,yshift=-0.6em]tgt_eda.south) -- ([xshift=-1.8em]tgt_eda.south);
\draw[line] (src_norm2.north) -- ([yshift=0.5em]src_norm2.north) -- ([xshift=4em,yshift=0.5em]src_norm2.north) -- ([xshift=4em,yshift=-0.95em]src_norm2.north)-- ([yshift=-0.6em]tgt_eda.south) -- (tgt_eda.south);
\draw[line,] (tgt_norm1.north) -- ([yshift=0.5em]tgt_norm1.north) -- ([yshift=0.5em,xshift=1.8em]tgt_norm1.north) -- ([xshift=1.8em]tgt_eda.south);
\draw[line,<->,out=-25,in=-155] ([xshift=-2em]tgt_sa.south) to ([xshift=2em]tgt_sa.south);
\begin{pgfonlayer}{background}
{
\node[draw=taupegray,thick,fill=ugreen!10,inner sep=0pt,minimum height=13em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box1) at (0em,7em){};
\node[draw=taupegray,thick,fill=yellow!10,inner sep=0pt,minimum height=4.7em,minimum width=9.5em,rounded corners=4pt,drop shadow] (box2) at (0em,13.6em){};
\node[draw=taupegray,thick,fill=blue!7,inner sep=0pt,minimum height=23.6em,minimum width=10.5em,rounded corners=4pt,drop shadow] (box3) at (9.7em,10.7em){};
}
\end{pgfonlayer}
\node[] at ([yshift=1.5em]box2.north){\normalsize{译文长度:5}};
\node[] at ([xshift=-2em,yshift=0.5em]box2.west){\normalsize{繁衍率}};
\node[] at ([xshift=-2em,yshift=-0.5em]box2.west){\normalsize{预测器}};
\node[] at ([xshift=-2em]box1.west){\normalsize{编码器}};
\node[] at ([xshift=-1em,yshift=-3.8em]box1.west){{$M \times$}};
\node[] at ([xshift=2em]box3.east){\normalsize{解码器}};
\node[] at ([xshift=1em,yshift=-7.5em]box3.east){{$\times N$}};
\draw[line,dotted,violet] (box2.north) -- ([yshift=1em]box2.north) -- ([yshift=1em,xshift=4.7em]box2.north) -- ([xshift=-2.4em]tgt_emb.west) -- (tgt_emb.west);
\draw[line,-,dotted,violet,] (src_emb.east) -- ([xshift=-2em]tgt_emb.west);
\end{tikzpicture}
......@@ -17,7 +17,7 @@
\node[module,anchor=west, minimum width=8em] (decoder2) at ([xshift=4em]decoder.east){解码器组件};
\node[module,anchor=north, minimum width=6em,font=\scriptsize,inner ysep=4pt] (deinput) at ([yshift=-2em]decoder2.south){解码端输入};
\node[anchor=south,font=\footnotesize] (mod1) at ([yshift=0.4em]encoder.north){\small\bfnew{编码器模块}};
\node[anchor=south,font=\footnotesize] (mod2) at ([yshift=0.4em]decoder.north){\small\bfnew{重排序模块}};
\node[anchor=south,font=\footnotesize] (mod2) at ([yshift=0.4em]decoder.north){\small\bfnew{序模块}};
\node[anchor=south,font=\footnotesize] (mod3) at ([yshift=0.4em]decoder2.north){\small\bfnew{解码端}};
\begin{pgfonlayer}{background}
......
......@@ -9,6 +9,7 @@
\node [anchor= west] (pos3) at ([xshift=3.0em]pos2.east){$\circ$};
\node [anchor= west] (pos2-2) at ([xshift=0.1em,yshift=1.0em]pos2.east){have};
\draw[->,thick](pos2.east)--(pos3.west);
\end{scope}
\begin{scope}[yshift=-4.0em]
......@@ -28,6 +29,7 @@
\node [anchor= west] (word3) at ([xshift=1.4em,yshift=-3em]pos4.east){She};
\node [anchor= west] (word4) at ([xshift=1.1em,yshift=2.8em]pos5.east){Have};
\node [anchor= west] (word5) at ([xshift=1.3em,yshift=-2.8em]pos5.east){Has};
\node [anchor= south] (labelb) at ([xshift=3em,yshift=-3em]word3.south){\small{(b)Lattice词串表示}};
\begin{pgfonlayer}{background}
{
% I
......@@ -54,6 +56,7 @@
\node [anchor= west] (pos3) at ([xshift=3.0em]pos2.east){$\circ$};
\node [anchor= west] (pos2-2) at ([xshift=0.1em,yshift=1.0em]pos2.east){has};
\draw[->,thick](pos2.east)--(pos3.west);
\node [anchor= south] (labela) at ([xshift=2em,yshift=-3em]pos1-2.south){\small{(a)$n$-best词串表示}};
\end{scope}
\end{tikzpicture}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论