Commit efc3f8f0 by xiaotong

Merge branch 'master' of 47.105.50.196:NiuTrans/mtbookv2

parents 00595ee1 c02dadd9
\begin{tikzpicture}
\tikzstyle{prob}=[minimum width=0.4em, fill=blue!15,inner sep=0pt]
\node[draw,fill=red!20,inner sep=0pt,minimum width=3em,minimum height=5em](key) at (0,0){};
\draw[] ([yshift=0.5em]key.180) -- ([yshift=0.5em]key.0);
\draw[] ([yshift=1.5em]key.180) -- ([yshift=1.5em]key.0);
\draw[] ([yshift=-0.5em]key.180) -- ([yshift=-0.5em]key.0);
\draw[] ([yshift=-1.5em]key.180) -- ([yshift=-1.5em]key.0);
\node[draw,fill=blue!20,inner sep=0pt,minimum width=3em,minimum height=5em](value) at (3em,0){};
\draw[] ([yshift=0.5em]value.180) -- ([yshift=0.5em]value.0);
\draw[] ([yshift=1.5em]value.180) -- ([yshift=1.5em]value.0);
\draw[] ([yshift=-0.5em]value.180) -- ([yshift=-0.5em]value.0);
\draw[] ([yshift=-1.5em]value.180) -- ([yshift=-1.5em]value.0);
\node[anchor=south,font=\footnotesize,inner sep=0pt] at ([yshift=0.1em]key.north){key};
\node[anchor=south,font=\footnotesize,inner sep=0pt] at ([yshift=0.2em]value.north){value};
\node[anchor=south,font=\footnotesize,inner sep=0pt] (cache)at ([yshift=2em,xshift=1.5em]key.north){\small\bfnew{Cache}};
\node[draw,anchor=east,minimum size=2.4em] (dt) at ([yshift=1.4em,xshift=-4em]key.west){$\mathbi{d}_\mathbi{t}$};
\node[draw,anchor=east,minimum size=2.4em] (st) at ([xshift=-4em]dt.west){$\mathbi{s}_\mathbi{t}$};
\node[draw,anchor=east,minimum size=2.4em] (st2) at ([xshift=-0.8em,yshift=4em]dt.west){$ \widetilde{\mathbi{s}}_\mathbi{t}$};
\node[draw,anchor=north,circle,inner sep=0pt, minimum size=1.2em,fill=yellow] (add) at ([yshift=-1em]st2.south){+};
\node[anchor=north,inner sep=0pt,font=\footnotesize,text=red] at ([yshift=-1em]add.south){combining};
\node[draw,anchor=east,minimum size=2.4em] (ct) at ([xshift=-3em,yshift=-3.5em]st.west){$ \widetilde{\mathbi{C}}_\mathbi{t}$};
\node[anchor=east] (y) at ([xshift=-6em,yshift=1em]st.west){$\mathbi{y}_{\mathbi{t}-\mathbi{1}}$};
\node[draw,anchor=east,minimum width=8em,minimum height=1.6em,fill=blue!20] (output) at ([xshift=-2.6em,yshift=2.6em]st2.west){};
\node[anchor=south] (yt) at ([yshift=5em]output.north){$\mathbi{y}_{\mathbi{t}}$};
\draw[] ([xshift=-0.8em]output.90) -- ([xshift=-0.8em]output.-90);
\draw[] ([xshift=-2.4em]output.90) -- ([xshift=-2.4em]output.-90);
\draw[] ([xshift=0.8em]output.90) -- ([xshift=0.8em]output.-90);
\draw[] ([xshift=2.4em]output.90) -- ([xshift=2.4em]output.-90);
\foreach \x/\y in {1/2,2/1,3/5,4/1,5/1,6/1,7/3,8/4,9/2,10/3,11/5,12/5,13/2,14/5,15/5,16/5,17/13,18/2,19/4,20/1}
\node[draw=blue!20,anchor=south,prob,minimum height=0.2em*\y] at ([yshift=1em,xshift=-4.2em+0.4em*\x]output.north){};
\begin{pgfonlayer}{background}
\node[inner sep=3pt,draw,dotted,rounded corners=2pt,very thick][fit=(key)(value)(cache)](box){};
\end{pgfonlayer}
\draw[-latex,dashed,very thick,out=-145,in=10] ([yshift=1.6em]box.180) to node[above,font=\footnotesize,text=red,rotate=25]{reading}(dt.0);
\draw[-latex,dashed,very thick,out=-5,in=-170] (ct.0) to node[above,font=\footnotesize,text=red,pos=0.7,rotate=8]{matching}([yshift=-2.5em]box.180);
\draw[-,very thick,out=0,in=-135](st.0) to (add.-135);
\draw[-,very thick,out=180,in=-45](dt.180) to (add.-45);
\draw[-latex,very thick] (add.90) -- (st2.-90);
\draw[-latex,very thick,out=100,in=-100] (ct.90) to (output.-90);
\draw[-latex,very thick,out=180,in=-100] (st2.180) to (output.-90);
\draw[-latex,very thick,out=80,in=-100] (y.90) to (output.-90);
\draw[-latex,very thick] (output.90) -- ([yshift=1em]output.90);
\draw[-latex,very thick] ([yshift=-1em]yt.-90) -- (yt.-90);
\end{tikzpicture}
\ No newline at end of file
\begin{tikzpicture}
\foreach \x in {1,2,3,4}
\node[inner sep=0pt,minimum size=1em,fill=ublue,circle] (c1_\x) at (0em+1.6em*\x, 0em){};
\foreach \x in {1,2,3,4,5,6}
\node[inner sep=0pt,minimum size=1em,fill=ublue,circle] (c2_\x) at (8.4em+1.6em*\x, 0em){};
\foreach \x in {1,2,3,4,5}
\node[inner sep=0pt,minimum size=1em,fill=ublue,circle] (c3_\x) at (20em+1.6em*\x, 0em){};
\foreach \x in {1,2,3,4,5}
\node[inner sep=0pt,minimum size=1em,fill=orange,circle] (c4_\x) at (20em+1.6em*\x, 9.4em){};
\node[inner sep=0pt,minimum size=1em,fill=ugreen,circle] (c5) at (9em, 7em){};
\node[inner sep=0pt,minimum size=1.2em,fill=ugreen,circle] (qs) at (18.6em, 5em){};
\node[inner sep=0pt,minimum size=1.2em,fill=ugreen,circle] (qw) at (18.6em, 3em){};
\node[fill=orange,inner sep=0pt, minimum size=1.2em, circle, text=white] (sigma) at (24.8em, 7em){\small\bfnew{$\sigma$}};
\node[fill=ugreen,inner sep=0pt, minimum size=1.2em, circle, text=white] (add1) at (4em, 3em){\small\bfnew{+}};
\node[fill=ugreen,inner sep=0pt, minimum size=1.2em, circle, text=white] (add2) at (14em, 3em){\small\bfnew{+}};
\node[fill=ugreen,inner sep=0pt, minimum size=1.2em, circle, text=white] (add3) at (9em, 5em){\small\bfnew{+}};
\begin{pgfonlayer}{background}
\node[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c1_1)(c1_4)](box1){};
\node[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c2_1)(c2_6)](box2){};
\node[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c3_1)(c3_5)](box3){};
\node[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c4_1)(c4_5)](box4){};
\node[draw,rounded corners=2pt,inner xsep=6pt,drop shadow,fill=white][fit=(c5)](box5){};
\end{pgfonlayer}
\node[draw,dash pattern=on 3pt off 1pt,minimum width=1.6em, minimum height=2em,very thick] (n1) at (24.8em,0em){};
\node[draw,dash pattern=on 3pt off 1pt,minimum width=1.6em, minimum height=2em,very thick] (n2) at (24.8em,9.4em){};
\node[] at (24.8em, -1.5em){$\mathbi{x}_\mathbi{t}$};
\node[text=ublue] at (8.2em, 0em) {\small\bfnew{...}};
\draw[-latex, out=70, in=-120] (c1_1.90) node[xshift=-0.4em,yshift=1.2em]{$ \mathbi{h}_ \mathbi{i}^ \mathbi{j}$}to (add1.-90);
\draw[-latex, out=80, in=-100] (c1_2.90) to (add1.-90);
\draw[-latex, out=100, in=-80] (c1_3.90) to (add1.-90);
\draw[-latex, out=110, in=-60] (c1_4.90) to (add1.-90);
\draw[-latex, out=60, in=-140] (c2_1.90) to (add2.-90);
\draw[-latex, out=70, in=-120] (c2_2.90) to (add2.-90);
\draw[-latex, out=80, in=-100] (c2_3.90) to (add2.-90);
\draw[-latex, out=100, in=-80] (c2_4.90) to (add2.-90);
\draw[-latex, out=110, in=-60] (c2_5.90) to (add2.-90);
\draw[-latex, out=120, in=-40] (c2_6.90) to (add2.-90);
\draw[-latex, out=20, in=-150] (add1.90) node[xshift=-0.4em,yshift=1.2em]{$ \mathbi{s}^ \mathbi{j}$} to (add3.-90);
\draw[-latex, out=160, in=-30] (add2.90) to (add3.-90);
\draw[-latex] (add3.90) -- (box5.-90);
\draw[-latex] (box5.0) -- node[xshift=-3em,above]{$ \mathbi{d}_\mathbi{t}$}(sigma.180);
\draw[-latex, ugreen!60] (qs.180) node[xshift=-1em,above,text=black]{$ \mathbi{q}_\mathbi{s}$}-- (add3.0);
\draw[-, ugreen!60] (qw.180) node[xshift=-1em,above,text=black]{$ \mathbi{q}_\mathbi{w}$}-- (add2.0);
\draw[-latex, ugreen!60] (add2.180) -- (add1.0);
\draw[-latex] (n1.130) -- (qw.0);
\draw[-latex] (n1.120) -- (qs.0);
\draw[-latex] (n1.90) node[yshift=1em,right]{$ \mathbi{h}_\mathbi{t}$}-- (sigma.-90);
\draw[-latex] (sigma.90) -- (n2.-90);
\draw[-latex] (n2.90) -- node[right]{$ \widetilde{\mathbi{h}}_\mathbi{t}$}([yshift=2em]n2.90);
\draw[decorate,decoration={brace, mirror},gray, thick] ([yshift=-2em]box1.-180) -- node[font=\scriptsize,text=black,below]{前几句}([yshift=-2em]box2.0);
\draw[decorate,decoration={brace, mirror},gray, thick] ([yshift=-2em]box3.-180) -- node[font=\scriptsize,text=black,below]{当前句}([yshift=-2em]box3.0);
%annotation
\node[fill=ublue,rounded corners=1pt,inner sep=0pt,minimum size=1em] (a1) at (2em,-4.5em) {};
\node[anchor=west,font=\footnotesize] (w1) at ([xshift=0.4em]a1.east) {编码表示};
\node[anchor=west,fill=ugreen,rounded corners=1pt,inner sep=0pt,minimum size=1em] (a2) at ([xshift=2em]w1.east) {};
\node[anchor=west,font=\footnotesize] (w2)at ([xshift=0.4em]a2.east) {层次注意力};
\node[anchor=west,fill=orange,rounded corners=1pt,inner sep=0pt,minimum size=1em] (a3) at ([xshift=2em]w2.east) {};
\node[anchor=west,font=\footnotesize] at ([xshift=0.4em]a3.east) {融合上下文信息的编码表示};
\end{tikzpicture}
\definecolor{color1}{rgb}{1,0.725,0.058}
\tikzstyle{coder} = [rectangle,thick,rounded corners,minimum width=2.8cm,minimum height=1.1cm,text centered,draw=black!70,fill=blue!10]
\tikzstyle{attention} = [rectangle,thick,rounded corners,minimum width=2.6cm,minimum height=0.9cm,text centered,draw=black!70,fill=green!25]
\tikzstyle{coder} = [rectangle,thick,rounded corners,minimum width=2.8cm,minimum height=1.1cm,text centered,draw=black!70,fill=blue!10,drop shadow]
\tikzstyle{attention} = [rectangle,thick,rounded corners,minimum width=2.6cm,minimum height=0.9cm,text centered,draw=black!70,fill=green!25,drop shadow]
\begin{tikzpicture}[node distance = 0,scale = 1]
\tikzstyle{every node}=[scale=1]
\begin{tikzpicture}[node distance = 0,scale = 0.7]
\tikzstyle{every node}=[scale=0.7]
\node(encoder_c)[coder]{\large{编码器}};
\node(encoder_s)[coder, right of = encoder_c, xshift=3.5cm, fill=red!25]{\large{编码器}};
\node(h_pre)[above of = encoder_c, yshift=1.3cm,scale=1.3]{${\mathbi{h}}_{pre}$};
......@@ -15,7 +15,7 @@
\node(current)[below of = encoder_s, yshift=-1.3cm]{\large{当前句}};
\node(attention_left)[attention, above of = encoder_c, xshift=2.4cm,yshift=3.1cm]{\large{注意力机制}};
\node(d)[above of = attention_left, yshift=1.1cm,scale=1.3]{$\mathbi{d}$};
\node(ground)[rectangle, thick, rounded corners, minimum width=5cm, minimum height=5.5cm, right of = encoder_s, xshift=4.4cm,yshift=2.2cm, draw=black!70, fill=gray!30]{};
\node(ground)[rectangle, thick, rounded corners, minimum width=5cm, minimum height=5.5cm, right of = encoder_s, xshift=4.4cm,yshift=2.2cm, draw=black!70, fill=gray!10]{};
\node(decoder)[above of = encoder_s, xshift=3.1cm]{\large{解码器}};
\node(attention_right)[attention, right of = attention_left, xshift=5.4cm,yshift=-0.4cm]{\large{注意力机制}};
\node(target)[right of = current, xshift=5.3cm]{\large{目标句}};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论