Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mtbookv2
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
NiuTrans
mtbookv2
Commits
eb0b2106
Commit
eb0b2106
authored
Dec 30, 2020
by
孟霞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
14两个图
parent
aa364d45
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
110 行增加
和
179 行删除
+110
-179
Chapter14/Figures/figure-3vs.tex
+85
-59
Chapter14/Figures/figure-syntax.tex
+25
-120
没有找到文件。
Chapter14/Figures/figure-3vs.tex
查看文件 @
eb0b2106
\tikzstyle
{
yy
}
= [circle,minimum height=1cm,text centered,draw=black,thick,drop shadow=
{
shadow xshift=0.3em,yshift=0.8em
}
,fill=white]
\begin{tikzpicture}
\begin{tikzpicture}
[node distance = 0,scale = 1]
\tikzstyle
{
decoder
}
= [rectangle,thick,rounded corners,minimum width=5cm,minimum height=0.6cm,text centered,draw=black!70,fill=blue!15]
\begin{scope}
[xshift=0.2in]
\tikzstyle
{
every node
}
=[scale=1]
\begin{scope}
\node
(y1)[yy]
{
\large
$
y
_
1
$}
;
\node
(aa)[decoder] at (0,0)
{}
;
\node
(y2)[yy,right of = y1,xshift=1.5cm]
{
\large
$
y
_
2
$}
;
\node
(y2b)[anchor=south] at ([yshift=-2.5em]aa.south)
{$
y
_
2
$}
;
\node
(y3)[yy,right of = y2,xshift=1.5cm]
{
\large
$
y
_
3
$}
;
\node
(label)[anchor=south] at ([yshift=-1.8em]y2b.south)
{
\small
{
(a) 自回归解码
}}
;
\node
(y4)[yy,right of = y3,xshift=1.5cm]
{
\large
$
y
_
4
$}
;
\node
(y1b)[anchor=east] at ([xshift=-2.5em]y2b.east)
{$
y
_
1
$}
;
\node
(y5)[yy,right of = y4,xshift=1.5cm]
{
\large
$
y
_
5
$}
;
\node
(sos)[anchor=east] at ([xshift=-4.3em]y2b.east)
{
\small
{
<sos>
}}
;
\node
(y6)[yy,right of = y5,xshift=1.5cm]
{
\large
$
y
_
6
$}
;
\node
(y3b)[anchor=west] at ([xshift=2.5em]y2b.west)
{$
y
_
3
$}
;
\node
[anchor=north,font=
\scriptsize
] (labela) at ([xshift=1.8em,yshift=-2em]y3.south)
{
(a) 自回归模型
}
;
\node
(y4b)[anchor=west] at ([xshift=5em]y2b.west)
{$
y
_
4
$}
;
\draw
[->,thick]
(y1.north) .. controls ([yshift=1.5em]y1.north) and ([yshift=1.5em]y3.north).. (y3.north);
\node
(y3a)[anchor=north] at ([yshift=2.5em]aa.north)
{$
y
_
3
$}
;
\draw
[->,thick]
(y1.north) .. controls ([yshift=2em]y1.north) and ([yshift=2em]y4.north).. (y4.north);
\node
(y2a)[anchor=east] at ([xshift=-2.5em]y3a.east)
{$
y
_
2
$}
;
\draw
[->,thick]
(y1.south) .. controls ([yshift=-1.5em]y1.south) and ([yshift=-1.5em]y5.south).. (y5.south);
\node
(y1a)[anchor=east] at ([xshift=-5em]y3a.east)
{$
y
_
1
$}
;
\draw
[->,thick]
(y1.south) .. controls ([yshift=-2em]y1.south) and ([yshift=-2em]y6.south).. (y6.south);
\node
(y4a)[anchor=west] at ([xshift=2.5em]y3a.west)
{$
y
_
4
$}
;
\node
(eos)[anchor=west] at ([xshift=4.3em]y3a.west)
{
\small
{
<eos>
}}
;
\draw
[->,thick]
(y2.north) .. controls ([yshift=1.5em]y2.north) and ([yshift=1.5em]y4.north).. (y4.north);
\draw
[->,thick]
(y2.south) .. controls ([yshift=-1.5em]y2.south) and ([yshift=-1.6em]y5.south).. (y5.south);
\draw
[->,very thick,dotted] ([xshift=-0.3em]y1a.east) .. controls +(east:0.5) and +(west:0.5) ..([xshift=0.3em]y1b.west);
\draw
[->,thick]
(y2.south) .. controls ([yshift=-2em]y2.south) and ([yshift=-2em]y6.south).. (y6.south);
\draw
[->,very thick,dotted] ([xshift=-0.3em]y2a.east) .. controls +(east:0.5) and +(west:0.5) ..([xshift=0.3em]y2b.west);
\draw
[->,very thick,dotted] ([xshift=-0.3em]y3a.east) .. controls +(east:0.5) and +(west:0.5) ..([xshift=0.3em]y3b.west);
\draw
[->,very thick,dotted] ([xshift=-0.3em]y4a.east) .. controls +(east:0.5) and +(west:0.5) ..([xshift=0.3em]y4b.west);
\draw
[->,thick]
(y3.south) .. controls ([yshift=-1.5em]y3.south) and ([yshift=-1.5em]y5.south).. (y5.south);
\draw
[->,thick]
(y3.south) .. controls ([yshift=-2em]y3.south) and ([yshift=-2em]y6.south).. (y6.south);
\node
(autodecoder)[decoder] at (0,0)
{
自回归编码器
}
;
\draw
[->,thick]
(y4.south) .. controls ([yshift=-1.5em]y4.south) and ([yshift=-1.5em]y6.south).. (y6.south);
\draw
[->,thick]([yshift=0em]y1b.north) to ([yshift=1.15em]y1b.north);
\draw
[->,thick]([yshift=0em]y2b.north) to ([yshift=1.15em]y2b.north);
\draw
[->,red,very thick]
(y1.east)to(y2.west);
\draw
[->,thick]([yshift=0em]y3b.north) to ([yshift=1.15em]y3b.north);
\draw
[->,red,very thick]
(y2.east)to(y3.west);
\draw
[->,thick]([yshift=0em]y4b.north) to ([yshift=1.15em]y4b.north);
\draw
[->,red,very thick]
(y3.east)to(y4.west);
\draw
[->,thick]([yshift=0em]sos.north) to ([yshift=1.15em]sos.north);
\draw
[->,red,very thick]
(y4.east)to(y5.west);
\draw
[->,red,very thick]
(y5.east)to(y6.west);
\draw
[->,thick]([yshift=-1.15em]y1a.south) to (y1a.south);
\draw
[->,thick]([yshift=-1.15em]y2a.south) to (y2a.south);
\draw
[->,thick]([yshift=-1.15em]y3a.south) to (y3a.south);
\draw
[->,thick]([yshift=-1.15em]y4a.south) to (y4a.south);
\draw
[->,thick]([yshift=-1.15em]eos.south) to (eos.south);
\end{scope}
\end{scope}
\begin{scope}
[yshift=-1.45in]
\begin{scope}
[yshift=-1.55in]
\tikzstyle
{
rec
}
= [rectangle,minimum width=2.8cm,minimum height=1.5cm,text centered,draw=black,dashed]
\node
(aa) [decoder] at (0,0)
{}
;
\tikzstyle
{
every node
}
=[scale=1]
\node
(y1y2b)[rectangle,anchor=south,inner sep=0.25em,densely dashed,draw] at ([yshift=-2.6em]aa.south)
{$
y
_
1
\;
y
_
2
$}
;
\node
(y1)[yy]
{
\large
$
y
_
1
$}
;
\node
(label)[anchor=south] at ([yshift=-2.1em]y1y2b.south)
{
\small
{
(b) 半自回归解码
}}
;
\node
(y2)[yy,right of = y1,xshift=1.5cm]
{
\large
$
y
_
2
$}
;
\node
(sos)[anchor=east] at ([xshift=-4.55em]y1y2b.east)
{
\small
{
<sos>
}}
;
\node
(y3)[yy,right of = y2,xshift=2cm]
{
\large
$
y
_
3
$}
;
\node
(y3y4b)[rectangle,anchor=west,inner sep=0.25em,densely dashed,draw] at ([xshift=4.7em]y1y2b.west)
{$
y
_
3
\;
y
_
4
$}
;
\node
(y4)[yy,right of = y3,xshift=1.5cm]
{
\large
$
y
_
4
$}
;
\node
(y5)[yy,right of = y4,xshift=2cm]
{
\large
$
y
_
5
$}
;
\node
(y3y4a)[rectangle,anchor=north,inner sep=0.25em,densely dashed,draw] at ([yshift=2.6em]aa.north)
{$
y
_
3
\;
y
_
4
$}
;
\node
(y6)[yy,right of = y5,xshift=1.5cm]
{
\large
$
y
_
6
$}
;
\node
(y1y2a)[rectangle,anchor=west,inner sep=0.25em,densely dashed,draw] at ([xshift=-4.7em]y3y4a.west)
{$
y
_
1
\;
y
_
2
$}
;
\node
(rec1)[rec,right of = y1,xshift=0.75cm]
{}
;
\node
(eos)[anchor=east] at ([xshift=4.7em]y3y4a.east)
{
\small
{
<eos>
}}
;
\node
(rec2)[rec,right of = y3,xshift=0.75cm]
{}
;
\node
(rec3)[rec,right of = y5,xshift=0.75cm]
{}
;
\draw
[->,very thick,dotted] ([xshift=-0em]y1y2a.east) .. controls +(east:0.5) and +(west:0.5) ..([xshift=0em]y1y2b.west);
\node
[anchor=north,font=
\scriptsize
] (labelb) at ([xshift=2.2em,yshift=-1em]y3.south)
{
(b) 半自回归模型
}
;
\draw
[->,very thick,dotted] ([xshift=-0em]y3y4a.east) .. controls +(east:0.5) and +(west:0.5) ..([xshift=0em]y3y4b.west);
\draw
[->,red,very thick]
(rec1.east)to(rec2.west);
\node
(autodecoder)[decoder] at (0,0)
{
半自回归编码器
}
;
\draw
[->,red,very thick]
(rec2.east)to(rec3.west);
\draw
[->,thick]([yshift=0.05em]sos.north) to ([yshift=1.38em]sos.north);
\draw
[->,thick]
(rec1.north) .. controls ([yshift=2.5em]rec1.north) and ([yshift=2.5em]rec3.north).. (rec3.north);
\draw
[->,thick]([yshift=0em]y1y2b.north) to ([yshift=1.38em]y1y2b.north);
\draw
[->,thick]([yshift=0em]y3y4b.north) to ([yshift=1.38em]y3y4b.north);
\draw
[->,thick]([yshift=-1.5em]y1y2a.south) to ([yshift=-0.02em]y1y2a.south);
\draw
[->,thick]([yshift=-1.5em]y3y4a.south) to ([yshift=-0.02em]y3y4a.south);
\draw
[->,thick]([yshift=-1.5em]eos.south) to ([yshift=-0.05em]eos.south);
\end{scope}
\end{scope}
\begin{scope}
[xshift=0.3in,yshift=-2.35in]
\tikzstyle
{
every node
}
=[scale=1]
\begin{scope}
[yshift=-3.1in]
\node
(y1)[yy]
{
\large
$
y
_
1
$}
;
\node
(aa) [decoder]at (0,0)
{
非自回归模型
}
;
\node
(y2)[yy,right of = y1,xshift=1.5cm]
{
\large
$
y
_
2
$}
;
\node
(y2b)[anchor=south] at ([xshift=-1.5em,yshift=-2.5em]aa.south)
{$
y
_
2
$}
;
\node
(y3)[yy,right of = y2,xshift=1.5cm]
{
\large
$
y
_
3
$}
;
\node
(label)[anchor=south] at ([yshift=-4.3em]aa.south)
{
\small
{
(c) 非自回归解码
}}
;
\node
(y4)[yy,right of = y3,xshift=1.5cm]
{
\large
$
y
_
4
$}
;
\node
(y1b)[anchor=east] at ([xshift=-3em]y2b.east)
{$
y
_
1
$}
;
\node
(y5)[yy,right of = y4,xshift=1.5cm]
{
\large
$
y
_
5
$}
;
\node
(y3b)[anchor=west] at ([xshift=3em]y2b.west)
{$
y
_
3
$}
;
\node
(y6)[yy,right of = y5,xshift=1.5cm]
{
\large
$
y
_
6
$}
;
\node
(y4b)[anchor=west] at ([xshift=6em]y2b.west)
{$
y
_
4
$}
;
\node
[anchor=north,font=
\scriptsize
] (labelc) at ([xshift=1.5em,yshift=-0.5em]y3.south)
{
(c) 非自回归模型
}
;
\node
(y2a)[anchor=north] at ([xshift=-1.5em,yshift=2.5em]aa.north)
{$
y
_
2
$}
;
\node
(y1a)[anchor=east] at ([xshift=-3em]y2a.east)
{$
y
_
1
$}
;
\node
(y3a)[anchor=west] at ([xshift=3em]y2a.west)
{$
y
_
3
$}
;
\node
(y4a)[anchor=west] at ([xshift=6em]y2a.west)
{$
y
_
4
$}
;
\draw
[->,thick]([yshift=0em]y1b.north) to ([yshift=1.15em]y1b.north);
\draw
[->,thick]([yshift=0em]y2b.north) to ([yshift=1.15em]y2b.north);
\draw
[->,thick]([yshift=0em]y3b.north) to ([yshift=1.15em]y3b.north);
\draw
[->,thick]([yshift=0em]y4b.north) to ([yshift=1.15em]y4b.north);
\draw
[->,thick]([yshift=-1.15em]y1a.south) to (y1a.south);
\draw
[->,thick]([yshift=-1.15em]y2a.south) to (y2a.south);
\draw
[->,thick]([yshift=-1.15em]y3a.south) to (y3a.south);
\draw
[->,thick]([yshift=-1.15em]y4a.south) to (y4a.south);
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
\ No newline at end of file
Chapter14/Figures/figure-syntax.tex
查看文件 @
eb0b2106
\definecolor
{
Melon
}{
rgb
}{
0.99, 0.74, 0.71
}
\begin{tikzpicture}
\definecolor
{
Goldenrod
}{
rgb
}{
0.85, 0.65, 0.13
}
\tikzstyle
{
encoder
}
= [rectangle,thick,rounded corners,minimum width=1.9cm,minimum height=1.2cm,text centered,draw=black!70,fill=red!25]
\definecolor
{
Cerulean
}{
rgb
}{
0, 0.48, 0.65
}
\tikzstyle
{
autodecoder
}
= [rectangle,thick,rounded corners,minimum width=3cm,minimum height=1.2cm,text centered,draw=black!70,fill=blue!15]
\definecolor
{
Gray
}{
rgb
}{
0.5, 0.5, 0.5
}
\tikzstyle
{
nonautodecoder
}
= [rectangle,thick,rounded corners,minimum width=3.4cm,minimum height=1.2cm,text centered,draw=black!70,fill=blue!15]
\definecolor
{
aliceblue
}{
rgb
}{
0.94, 0.97, 1.0
}
\tikzstyle
{
emb
}
= [rectangle,very thick,rounded corners,minimum width=3cm,minimum height=0.85cm,text centered,draw=black!70,fill=red!15]
\node
(encoder)[encoder] at (0,0)
{
编码器
}
;
\tikzstyle
{
sa
}
= [rectangle,very thick,rounded corners,minimum width=3cm,minimum height=1cm,text centered,draw=black!70,fill=yellow!20]
\node
(text
_
left)[anchor=south] at ([yshift=-3em]encoder.south)
{
\footnotesize
{
猫
\
在
\
熟睡
}}
;
\tikzstyle
{
edsa
}
= [rectangle,very thick,rounded corners,minimum width=3cm,minimum height=1.5cm,text centered,align=center,draw=black!70,fill=yellow!20]
\node
(autodecoder)[autodecoder,right of=encoder,xshift=6em ]
{
自回归解码器
}
;
\tikzstyle
{
an
}
= [rectangle,very thick,rounded corners,minimum width=3.5cm,minimum height=0.7cm,text centered,draw=black!70,fill=aliceblue]
\node
(text
_
mid1)[anchor=north] at ([yshift=3em]autodecoder.north)
{
\scriptsize
{
NP1
\
VP3
\
<eos>
}}
;
\tikzstyle
{
ff
}
= [rectangle,very thick,rounded corners,minimum width=3cm,minimum height=1cm,text centered,align=center,draw=black!70,fill=orange!20]
\node
(text
_
mid2)[anchor=south] at ([yshift=-3em]autodecoder.south)
{
\scriptsize
{
<sos>
\
NP1
\
VP3
}}
;
\tikzstyle
{
linear
}
= [rectangle,very thick,rounded corners,minimum width=3cm,minimum height=0.7cm,text centered,draw=black!70,fill=green!20]
\node
(nonautodecoder)[nonautodecoder,right of=autodecoder,xshift=10.5em ]
{
非自回归解码器
}
;
\tikzstyle
{
softmax
}
= [rectangle,very thick,rounded corners,minimum width=3cm,minimum height=0.7cm,text centered,draw=black!70,fill=blue!20]
\node
(text
_
right1)[anchor=north] at ([yshift=3em]nonautodecoder.north)
{
\scriptsize
{
NP1
\;
Cats
\;
VP3
\;
sleep
\;
a
\;
lot
}}
;
\begin{tikzpicture}
[node distance = 0,scale = 0.7]
\node
(text
_
right2)[anchor=south] at ([yshift=-3em]nonautodecoder.south)
{
\scriptsize
{
NP1
\;
<Mask>
\;
VP3
\;
<Mask>
\;
<Mask>
\;
<Mask>
}}
;
\tikzstyle
{
every node
}
=[scale=0.7]
%left
\node
(left
_
Emb)[emb]
{
\footnotesize
{
\textbf
{
Input Embedding
}}}
;
\draw
[->,thick]
([yshift=0.1em]text
_
left.north) to (encoder.south);
\node
(left
_
cir)[circle,very thick,minimum width=0.5cm,draw=black!70,above of = left
_
Emb,yshift=1.1cm]
{}
;
\draw
[->,thick]
([yshift=0.1em]text
_
mid2.north) to (autodecoder.south);
\draw
[-,very thick,draw=black!70]
([xshift=0.03cm]left
_
cir.west)--([xshift=-0.03cm]left
_
cir.east);
\draw
[->,thick]
(autodecoder.north) to ([yshift=-0.1em]text
_
mid1.south);
\draw
[-,very thick,draw=black!70]
([yshift=-0.03cm]left
_
cir.north)--([yshift=0.03cm]left
_
cir.south);
\draw
[->,thick]
([yshift=0.1em]text
_
right2.north) to (nonautodecoder.south);
\node
(left
_
cir2)[circle,very thick,minimum width=0.5cm,draw=black!70,left of = left
_
cir,xshift=-1.5cm]
{}
;
\draw
[->,thick]
(nonautodecoder.north) to ([yshift=-0.1em]text
_
right1.south);
\draw
[very thick,draw=black!70]
([xshift=0.04cm]left
_
cir2.west)sin([xshift=0.14cm,yshift=0.08cm]left
_
cir2.west)cos([xshift=0.25cm]left
_
cir2.west)sin([xshift=0.36cm,yshift=-0.08cm]left
_
cir2.west)cos([xshift=-0.03cm]left
_
cir2.east);
\draw
[->,thick]
(text
_
mid1.east) -- ([xshift=2.1em]text
_
mid1.east) -- ([xshift=-1.2em]text
_
right2.west)-- (text
_
right2.west);
\draw
[->,very thick,draw=black!70](left
_
cir2.east)--(left
_
cir.west);
\draw
[-,thick]
(encoder.north) to ([yshift=0.8em]encoder.north);
\node
(left
_
Self)[sa,above of = left
_
cir,yshift=1.6cm]
{
\textbf
{
Self-Attention
}}
;
\draw
[-,thick,dashed]
([yshift=0.8em]encoder.north) -- ([xshift=-7em,yshift=0.8em]nonautodecoder.north) -- ([xshift=-2.5em]nonautodecoder.west);
\node
(left
_
Add
_
bottom)[an,above of = left
_
Self,yshift=1.1cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\draw
[->,thick]
([xshift=-2.5em]nonautodecoder.west) to (nonautodecoder.west);
\node
(left
_
Feed)[ff,above of = left
_
Add
_
bottom,yshift=1.2cm]
{
\textbf
{
Feed Forward
}
\\\textbf
{
Network
}}
;
\node
(left
_
Add
_
top)[an,above of = left
_
Feed,yshift=1.1cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(left
_
text
_
bottom)[below of = left
_
Emb,xshift=0cm,yshift=-1.2cm,scale=1]
{
\small\sffamily\bfseries
{
我
\quad
爱
\quad
我的
\quad
狗
}}
;
\draw
[->,very thick,draw=black!70]([yshift=-0.5cm]left
_
Emb.south)--(left
_
Emb.south);
\draw
[->,very thick,draw=black!70](left
_
Emb.north)--(left
_
cir.south);
\draw
[->,very thick,draw=black!70](left
_
cir.north)--(left
_
Self.south);
\draw
[->,very thick,draw=black!70](left
_
Self.north)--(left
_
Add
_
bottom.south);
\draw
[->,very thick,draw=black!70](left
_
Add
_
bottom.north)--(left
_
Feed.south);
\draw
[->,very thick,draw=black!70](left
_
Feed.north)--(left
_
Add
_
top.south);
\draw
[->,very thick,draw=black!70]([yshift=0.35cm]left
_
cir.north)--([xshift=-2.27cm,yshift=0.35cm]left
_
cir.north)--([xshift=-0.5cm]left
_
Add
_
bottom.west)--(left
_
Add
_
bottom.west);
\draw
[->,very thick,draw=black!70]([yshift=0.1cm]left
_
Add
_
bottom.north)--([xshift=-2.27cm,yshift=0.1cm]left
_
Add
_
bottom.north)--([xshift=-0.5cm]left
_
Add
_
top.west)--(left
_
Add
_
top.west);
\draw
[->,very thick,draw=black!70,in=250,out=0]
([yshift=0.5cm]left
_
cir.north)to([xshift=0.9cm]left
_
Self.south);
\draw
[->,very thick,draw=black!70,in=290,out=180]
([yshift=0.5cm]left
_
cir.north)to([xshift=-0.9cm]left
_
Self.south);
%middle
\node
(Emb)[emb,right of = left
_
Emb,xshift=5cm]
{
\footnotesize
{
\textbf
{
Parser Embedding
}}}
;
\node
(cir)[circle,very thick,draw=black!70,minimum width=0.5cm,above of = Emb,yshift=1.1cm]
{}
;
\draw
[-,very thick,draw=black!70]
([xshift=0.03cm]cir.west)--([xshift=-0.03cm]cir.east);
\draw
[-,very thick,draw=black!70]
([yshift=-0.03cm]cir.north)--([yshift=0.03cm]cir.south);
\node
(cir2)[circle,very thick,minimum width=0.5cm,draw=black!70,right of = cir,xshift=1.5cm]
{}
;
\draw
[very thick,draw=black!70]
([xshift=0.04cm]cir2.west)sin([xshift=0.14cm,yshift=0.08cm]cir2.west)cos([xshift=0.25cm]cir2.west)sin([xshift=0.36cm,yshift=-0.08cm]cir2.west)cos([xshift=-0.03cm]cir2.east);
\node
(Self)[sa,above of = cir,yshift=1.6cm]
{
\textbf
{
Self-Attention
}}
;
\node
(Add
_
bottom)[an,above of = Self,yshift=1.1cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(ED
_
Self)[edsa,above of = Add
_
bottom,yshift=1.8cm]
{
\textbf
{
Encoder-Decoder
}
\\
\textbf
{
Attention
}}
;
\node
(Add
_
mid)[an,above of = ED
_
Self,yshift=1.35cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(Feed)[ff,above of = Add
_
mid,yshift=1.2cm]
{
\textbf
{
Feed Forward
}
\\
\textbf
{
Network
}}
;
\node
(Add
_
top)[an,above of = Feed,yshift=1.1cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(Linear)[linear,above of = Add
_
top,yshift=1.3cm]
{
\textbf
{
Linear
}}
;
\node
(Softmax)[softmax,above of = Linear,yshift=1cm]
{
\textbf
{
Softmax
}}
;
\node
(text
_
bottom)[below of = Emb,xshift=0.2cm,yshift=-1.2cm,scale=0.9]
{
\textbf
{
VP1
\ \
VP3
\ \
<eos>
}}
;
\node
(text
_
top)[above of = Softmax,xshift=0.2cm,yshift=1.2cm,scale=0.9]
{
\textbf
{
VP1
\ \
VP3
\ \
<eos>
}}
;
\draw
[->,very thick,draw=black!70]([yshift=-0.5cm]Emb.south)--(Emb.south);
\draw
[->,very thick,draw=black!70]([xshift=0.9cm,yshift=-0.5cm]Emb.south)--([xshift=0.9cm]Emb.south);
\draw
[->,very thick,draw=black!70]([xshift=-0.9cm,yshift=-0.5cm]Emb.south)--([xshift=-0.9cm]Emb.south);
\draw
[->,very thick,draw=black!70](Emb.north)--(cir.south);
\draw
[->,very thick,draw=black!70](cir.north)--(Self.south);
\draw
[->,very thick,draw=black!70](cir2.west)--(cir.east);
\draw
[->,very thick,draw=black!70,in=250,out=0]
([yshift=0.5cm]cir.north)to([xshift=0.9cm]Self.south);
\draw
[->,very thick,draw=black!70,in=290,out=180]
([yshift=0.5cm]cir.north)to([xshift=-0.9cm]Self.south);
\draw
[->,very thick,draw=black!70](Self.north)--(Add
_
bottom.south);
\draw
[->,very thick,draw=black!70](ED
_
Self.north)--(Add
_
mid.south);
\draw
[->,very thick,draw=black!70](Add
_
mid.north)--(Feed.south);
\draw
[->,very thick,draw=black!70](Feed.north)--(Add
_
top.south);
\draw
[->,very thick,draw=black!70](Add
_
top.north)--(Linear.south);
\draw
[->,very thick,draw=black!70](Linear.north)--(Softmax.south);
\draw
[->,very thick,draw=black!70](Softmax.north)--([yshift=0.5cm]Softmax.north);
\draw
[->,very thick,draw=black!70]([yshift=0.35cm]cir.north)--([xshift=2.27cm,yshift=0.35cm]cir.north)--([xshift=0.5cm]Add
_
bottom.east)--(Add
_
bottom.east);
\draw
[->,very thick,draw=black!70]([yshift=0.1cm]Add
_
mid.north)--([xshift=2.27cm,yshift=0.1cm]Add
_
mid.north)--([xshift=0.5cm]Add
_
top.east)--(Add
_
top.east);
\draw
[->,very thick,draw=black!70](left
_
Add
_
top.north)--([yshift=0.6cm]left
_
Add
_
top.north)--([xshift=2.27cm,yshift=0.6cm]left
_
Add
_
top.north)--([xshift=2.27cm,yshift=-2cm]left
_
Add
_
top.north)--([xshift=5cm,yshift=-2cm]left
_
Add
_
top.north)--(ED
_
Self.south);
\draw
[->,very thick,draw=black!70]([xshift=0.9cm,yshift=-0.45cm]ED
_
Self.south)--([xshift=0.9cm]ED
_
Self.south);
\draw
[->,very thick,draw=black!70]([xshift=-0.9cm,yshift=-0.35cm]ED
_
Self.south)--([xshift=-0.9cm]ED
_
Self.south);
\draw
[->,very thick,draw=black!70](Add
_
bottom.north)--([yshift=0.2cm]Add
_
bottom.north)--([xshift=2.27cm,yshift=0.2cm]Add
_
bottom.north)--([xshift=0.5cm]Add
_
mid.east)--(Add
_
mid.east);
%right
\node
(right
_
Emb)[emb,right of = Emb,xshift=5.5cm]
{
\footnotesize
{
\textbf
{
Parser Embedding
}}}
;
\node
(right
_
cir)[circle,very thick,minimum width=0.5cm,draw=black!70,above of = right
_
Emb,yshift=1.1cm]
{}
;
\draw
[-,very thick,draw=black!70]
([xshift=0.03cm]right
_
cir.west)--([xshift=-0.03cm]right
_
cir.east);
\draw
[-,very thick,draw=black!70]
([yshift=-0.03cm]right
_
cir.north)--([yshift=0.03cm]right
_
cir.south);
\node
(right
_
cir2)[circle,very thick,minimum width=0.5cm,draw=black!70,right of = right
_
cir,xshift=1.5cm]
{}
;
\draw
[very thick,draw=black!70]
([xshift=0.04cm]right
_
cir2.west)sin([xshift=0.14cm,yshift=0.08cm]right
_
cir2.west)cos([xshift=0.25cm]right
_
cir2.west)sin([xshift=0.36cm,yshift=-0.08cm]right
_
cir2.west)cos([xshift=-0.03cm]right
_
cir2.east);
\node
(right
_
Self)[sa,above of = right
_
cir,yshift=1.6cm]
{
\textbf
{
Self-Attention
}}
;
\node
(right
_
Add
_
bottom)[an,above of = right
_
Self,yshift=1.1cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(right
_
ED
_
Self)[edsa,above of = right
_
Add
_
bottom,yshift=1.8cm]
{
\textbf
{
Encoder-Decoder
}
\\\textbf
{
Attention
}}
;
\node
(right
_
Add
_
mid)[an,above of = right
_
ED
_
Self,yshift=1.35cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(right
_
Feed)[ff,above of = right
_
Add
_
mid,yshift=1.2cm]
{
\textbf
{
Feed Forward
}
\\\textbf
{
Network
}}
;
\node
(right
_
Add
_
top)[an,above of = right
_
Feed,yshift=1.1cm]
{
\textbf
{
Add
\&
LayerNorm
}}
;
\node
(right
_
Linear)[linear,above of = right
_
Add
_
top,yshift=1.3cm]
{
\textbf
{
Linear
}}
;
\node
(right
_
Softmax)[softmax,above of = right
_
Linear,yshift=1cm]
{
\textbf
{
Softmax
}}
;
\node
(right
_
text
_
bottom)[below of = right
_
Emb,xshift=1.2cm,yshift=-1.2cm,scale=0.8]
{
\textbf
{
VP1 <Mask> VP3 <Mask> <Mask> <Mask>
}}
;
\node
(right
_
text
_
top)[above of = right
_
Softmax,xshift=0cm,yshift=1.2cm,scale=0.9]
{
\textbf
{
VP1 I VP3 love my dog
}}
;
\draw
[->,very thick,draw=black!70]([yshift=-0.5cm]right
_
Emb.south)--(right
_
Emb.south);
\draw
[->,very thick,draw=black!70](right
_
Emb.north)--(right
_
cir.south);
\draw
[->,very thick,draw=black!70](right
_
cir.north)--(right
_
Self.south);
\draw
[->,very thick,draw=black!70](right
_
cir2.west)--(right
_
cir.east);
\draw
[->,very thick,draw=black!70,in=250,out=0]
([yshift=0.5cm]right
_
cir.north)to([xshift=0.9cm]right
_
Self.south);
\draw
[->,very thick,draw=black!70,in=290,out=180]
([yshift=0.5cm]right
_
cir.north)to([xshift=-0.9cm]right
_
Self.south);
\draw
[->,very thick,draw=black!70](right
_
Self.north)--(right
_
Add
_
bottom.south);
\draw
[->,very thick,draw=black!70](right
_
ED
_
Self.north)--(right
_
Add
_
mid.south);
\draw
[->,very thick,draw=black!70](right
_
Add
_
mid.north)--(right
_
Feed.south);
\draw
[->,very thick,draw=black!70](right
_
Feed.north)--(right
_
Add
_
top.south);
\draw
[->,very thick,draw=black!70](right
_
Add
_
top.north)--(right
_
Linear.south);
\draw
[->,very thick,draw=black!70](right
_
Linear.north)--(right
_
Softmax.south);
\draw
[->,very thick,draw=black!70](right
_
Softmax.north)--([yshift=0.5cm]right
_
Softmax.north);
\draw
[->,very thick,draw=black!70]([yshift=0.35cm]right
_
cir.north)--([xshift=2.27cm,yshift=0.35cm]right
_
cir.north)--([xshift=0.5cm]right
_
Add
_
bottom.east)--(right
_
Add
_
bottom.east);
\draw
[->,very thick,draw=black!70]([yshift=0.1cm]right
_
Add
_
mid.north)--([xshift=2.27cm,yshift=0.1cm]right
_
Add
_
mid.north)--([xshift=0.5cm]right
_
Add
_
top.east)--(right
_
Add
_
top.east);
\draw
[->,very thick,draw=black!70]([xshift=0.9cm,yshift=-0.45cm]right
_
ED
_
Self.south)--([xshift=0.9cm]right
_
ED
_
Self.south);
\draw
[->,very thick,draw=black!70]([xshift=-0.9cm,yshift=-0.35cm]right
_
ED
_
Self.south)--([xshift=-0.9cm]right
_
ED
_
Self.south);
\draw
[-,very thick,dashed,draw=black!70]([xshift=2.2cm,yshift=0.6cm]left
_
Add
_
top.north)--([xshift=2.2cm,yshift=3.5cm]left
_
Add
_
top.north)--([xshift=8cm,yshift=3.5cm]left
_
Add
_
top.north)--([xshift=8cm,yshift=-2cm]left
_
Add
_
top.north);
\draw
[->,very thick,draw=black!70](right
_
Add
_
bottom.north)--([yshift=0.2cm]right
_
Add
_
bottom.north)--([xshift=2.27cm,yshift=0.2cm]right
_
Add
_
bottom.north)--([xshift=0.5cm]right
_
Add
_
mid.east)--(right
_
Add
_
mid.east);
\draw
[->,very thick,draw=black!70]([xshift=8cm,yshift=-2cm]left
_
Add
_
top.north)--([yshift=0.3cm]right
_
Add
_
bottom.north)--(right
_
ED
_
Self.south);
\draw
[->,very thick,draw=black!70](Softmax.east)--([xshift=1.2cm]Softmax.east)--([xshift=1.2cm,yshift=-12.75cm]Softmax.east)--([xshift=2cm,yshift=-12.75cm]Softmax.east);
%module
\node
(left
_
module)[rectangle,very thick,rounded corners,minimum width=4.5cm,minimum height=5.3cm,text centered,draw=black!70,above of = left
_
Emb,xshift=-0.25cm,yshift=4.1cm]
{}
;
\node
(module)[rectangle,very thick,rounded corners,minimum width=4.5cm,minimum height=8.4cm,text centered,draw=black!70,above of = Emb,xshift=0.25cm,yshift=5.65cm]
{}
;
\node
(right
_
module)[rectangle,very thick,rounded corners,minimum width=4.5cm,minimum height=8.4cm,text centered,draw=black!70,above of = right
_
Emb,xshift=0.25cm,yshift=5.65cm]
{}
;
\node
(N)[right of = right
_
ED
_
Self,xshift=3cm,yshift=-3.7cm,scale=1.3]
{
\textbf
{$
N
\times
$}}
;
\node
(left
_
N)[left of = left
_
Feed,xshift=-3cm,yshift=-3cm,scale=1.3]
{
\textbf
{$
N
\times
$}}
;
\node
(M)[left of = ED
_
Self,xshift=-2.5cm,yshift=-3.7cm,scale=1.3]
{
\textbf
{$
M
\times
$}}
;
\end{tikzpicture}
\end{tikzpicture}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论