Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Toy-MT-Introduction
概览
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
Toy-MT-Introduction
Commits
7c5bc124
Commit
7c5bc124
authored
Nov 24, 2019
by
Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GNMT figure
parent
2ce5cead
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
232 行增加
和
0 行删除
+232
-0
Section06-Neural-Machine-Translation/section06.tex
+232
-0
没有找到文件。
Section06-Neural-Machine-Translation/section06.tex
查看文件 @
7c5bc124
...
...
@@ -2791,6 +2791,238 @@ $\textrm{``you''} = \argmax_{y} \textrm{P}(y|\textbf{s}_1, \alert{\textbf{C}})$
%%% GNMT
\begin{frame}
{
成功案例 - GNMT
}
%% GNMT的图和几句话说它多牛
\begin{center}
\begin{tikzpicture}
\setlength
{
\base
}{
0.25cm
}
\tikzstyle
{
rnnnode
}
= [minimum height=1.1em,minimum width=1.1em,inner sep=2pt,rounded corners=1pt,draw,fill=red!20,font=
\scriptsize
];
\tikzstyle
{
wnode
}
= [minimum height=1.2em,inner sep=3pt,rounded corners=1pt,font=
\scriptsize
];
% Encoder
\begin{scope}
\node
[rnnnode,fill=green!20]
(encemb1) at (0,0)
{}
;
\node
[rnnnode,fill=green!20,right=\base of encemb1]
(encemb2)
{}
;
\node
[rnnnode,draw=white,fill=white,right=\base of encemb2]
(encemb3)
{$
\cdots
$}
;
\node
[rnnnode,fill=green!20,right=\base of encemb3]
(encemb4)
{}
;
\node
[rnnnode,above=\base of encemb1]
(enc11)
{}
;
\node
[rnnnode,above=\base of encemb2]
(enc12)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of encemb3]
(enc13)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of encemb4]
(enc14)
{}
;
\foreach
\cur
[count=
\prev
from 1] in
{
2,...,4
}
{
\node
[rnnnode,above=\base of enc\prev1]
(enc
\cur
1)
{}
;
\node
[rnnnode,above=\base of enc\prev2]
(enc
\cur
2)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of enc\prev3]
(enc
\cur
3)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of enc\prev4]
(enc
\cur
4)
{}
;
}
\node
[rnnnode,draw=white,fill=white,above=\base of enc41]
(enc51)
{$
\cdots
$}
;
\node
[rnnnode,draw=white,fill=white,above=\base of enc42]
(enc52)
{$
\cdots
$}
;
\node
[rnnnode,draw=white,fill=white,above=\base of enc43]
(enc53)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of enc44]
(enc54)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of enc51]
(enc61)
{}
;
\node
[rnnnode,above=\base of enc52]
(enc62)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of enc53]
(enc63)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of enc54]
(enc64)
{}
;
% words
\node
[wnode,below=0pt of encemb1]
(encword1)
{
你
}
;
\node
[wnode,below=0pt of encemb2]
(encword2)
{
什么
}
;
\node
[wnode,below=0pt of encemb4]
(encword4)
{
EOS
}
;
% connections
\draw
[-latex']
(enc11) to (enc12);
\draw
[-latex']
(enc12) to (enc13);
\draw
[-latex']
(enc13) to (enc14);
\draw
[-latex']
(enc24) to (enc23);
\draw
[-latex']
(enc23) to (enc22);
\draw
[-latex']
(enc22) to (enc21);
\draw
[-latex']
(enc31) to (enc32);
\draw
[-latex']
(enc32) to (enc33);
\draw
[-latex']
(enc33) to (enc34);
\draw
[-latex']
(enc41) to (enc42);
\draw
[-latex']
(enc42) to (enc43);
\draw
[-latex']
(enc43) to (enc44);
\draw
[-latex']
(enc61) to (enc62);
\draw
[-latex']
(enc62) to (enc63);
\draw
[-latex']
(enc63) to (enc64);
\draw
[-latex']
(encemb1) to (enc11);
\draw
[-latex']
(encemb2) to (enc12);
\draw
[-latex']
(encemb4) to (enc14);
\draw
[-latex']
([xshift=2pt]encemb1.north) to [out=30,in=-30] ([xshift=2pt]enc21.south);
\draw
[-latex']
([xshift=2pt]encemb2.north) to [out=30,in=-30] ([xshift=2pt]enc22.south);
\draw
[-latex']
([xshift=2pt]encemb4.north) to [out=30,in=-30] ([xshift=2pt]enc24.south);
\draw
[-latex']
([xshift=-2pt]enc11.north) to [out=150,in=-150] ([xshift=-2pt]enc31.south);
\draw
[-latex']
([xshift=-2pt]enc12.north) to [out=150,in=-150] ([xshift=-2pt]enc32.south);
\draw
[-latex']
([xshift=-2pt]enc14.north) to [out=150,in=-150] ([xshift=-2pt]enc34.south);
\draw
[-latex']
(enc22) to (enc32);
\draw
[-latex']
(enc21) to (enc31);
\draw
[-latex']
(enc24) to (enc34);
\draw
[-latex']
([xshift=-2pt]enc31.north) to [out=150,in=-150] ([xshift=-2pt]enc51.south);
\draw
[-latex']
([xshift=-2pt]enc32.north) to [out=150,in=-150] ([xshift=-2pt]enc52.south);
\draw
[-latex']
([xshift=-2pt]enc34.north) to [out=150,in=-150] ([xshift=-2pt]enc54.south);
\draw
[-latex']
(enc31) to (enc41);
\draw
[-latex']
(enc32) to (enc42);
\draw
[-latex']
(enc34) to (enc44);
\draw
[-latex']
(enc41) to (enc51);
\draw
[-latex']
(enc42) to (enc52);
\draw
[-latex']
(enc44) to (enc54);
\draw
[-latex']
(enc51) to (enc61);
\draw
[-latex']
(enc52) to (enc62);
\draw
[-latex']
(enc54) to (enc64);
\draw
[-latex']
(enc61) to ([yshift=
\base
]enc61.north);
\draw
[-latex']
(enc62) to ([yshift=
\base
]enc62.north);
\draw
[-latex']
(enc64) to ([yshift=
\base
]enc64.north);
\end{scope}
\node
[rnnnode,fill=orange!20,minimum width=3.5cm,anchor=south west]
(attention) at ([yshift=
\base
]enc61.north west)
{
注意力机制
}
;
\begin{scope}
\node
[rnnnode,fill=green!20,right=2.5cm of encemb4]
(decemb1)
{}
;
\node
[rnnnode,fill=green!20,right=\base of decemb1]
(decemb2)
{}
;
\node
[rnnnode,draw=white,fill=white,right=\base of decemb2]
(decemb3)
{$
\cdots
$}
;
\node
[rnnnode,fill=green!20,right=\base of decemb3]
(decemb4)
{}
;
\node
[rnnnode,above=\base of decemb1]
(dec11)
{}
;
\node
[rnnnode,above=\base of decemb2]
(dec12)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of decemb3]
(dec13)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of decemb4]
(dec14)
{}
;
\node
[rnnnode,above=\base of dec11]
(dec21)
{}
;
\node
[rnnnode,above=\base of dec12]
(dec22)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec13]
(dec23)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of dec14]
(dec24)
{}
;
\node
[rnnnode,above=\base of dec21]
(dec31)
{}
;
\node
[rnnnode,above=\base of dec22]
(dec32)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec23]
(dec33)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of dec24]
(dec34)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec31]
(dec41)
{$
\cdots
$}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec32]
(dec42)
{$
\cdots
$}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec33]
(dec43)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec34]
(dec44)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of dec41]
(dec51)
{}
;
\node
[rnnnode,above=\base of dec42]
(dec52)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec43]
(dec53)
{$
\cdots
$}
;
\node
[rnnnode,above=\base of dec44]
(dec54)
{}
;
\node
[rnnnode,fill=blue!20,above=\base of dec51]
(softmax1)
{}
;
\node
[rnnnode,fill=blue!20,above=\base of dec52]
(softmax2)
{}
;
\node
[rnnnode,draw=white,fill=white,above=\base of dec53]
(softmax3)
{$
\cdots
$}
;
\node
[rnnnode,fill=blue!20,above=\base of dec54]
(softmax4)
{}
;
% words
\node
[wnode,below=0pt of decemb1]
(decinword1)
{
SOS
}
;
\node
[wnode,below=0pt of decemb2]
(decinword2)
{
Have
}
;
\node
[wnode,below=0pt of decemb4]
(decinword4)
{
?
}
;
\node
[wnode,above=0pt of softmax1]
(decoutword1)
{
Have
}
;
\ExtractX
{$
(
softmax
2
.north
)
$}
\ExtractY
{$
(
decoutword
1
.base
)
$}
\node
[wnode,anchor=base]
(decoutword2) at (
\XCoord
,
\YCoord
)
{
you
}
;
\ExtractX
{$
(
softmax
4
.north
)
$}
\ExtractY
{$
(
decoutword
1
.base
)
$}
\node
[wnode,anchor=base]
(decoutword4) at (
\XCoord
,
\YCoord
)
{
EOS
}
;
% connections
\draw
[-latex']
(dec11) to (dec12);
\draw
[-latex']
(dec12) to (dec13);
\draw
[-latex']
(dec13) to (dec14);
\draw
[-latex']
(dec21) to (dec22);
\draw
[-latex']
(dec22) to (dec23);
\draw
[-latex']
(dec23) to (dec24);
\draw
[-latex']
(dec31) to (dec32);
\draw
[-latex']
(dec32) to (dec33);
\draw
[-latex']
(dec33) to (dec34);
\draw
[-latex']
(dec51) to (dec52);
\draw
[-latex']
(dec52) to (dec53);
\draw
[-latex']
(dec53) to (dec54);
\draw
[-latex']
(decemb1) to (dec11);
\draw
[-latex']
(decemb2) to (dec12);
\draw
[-latex']
(decemb4) to (dec14);
\foreach
\cur
[count=
\prev
from 1] in
{
2,...,5
}
{
\draw
[-latex']
(dec
\prev
1) to (dec
\cur
1);
\draw
[-latex']
(dec
\prev
2) to (dec
\cur
2);
\draw
[-latex']
(dec
\prev
4) to (dec
\cur
4);
}
\draw
[-latex']
([xshift=-2pt]dec21.north) to [out=150,in=-150] ([xshift=-2pt]dec41.south);
\draw
[-latex']
([xshift=-2pt]dec22.north) to [out=150,in=-150] ([xshift=-2pt]dec42.south);
\draw
[-latex']
([xshift=-2pt]dec24.north) to [out=150,in=-150] ([xshift=-2pt]dec44.south);
\draw
[-latex']
(dec51) to (softmax1);
\draw
[-latex']
(dec52) to (softmax2);
\draw
[-latex']
(dec54) to (softmax4);
\end{scope}
% attention connections
\draw
[-latex',rounded corners=2pt]
(dec11) -| ([xshift=-0.4cm]attention.south east);
\ExtractX
{$
([
xshift
=
9
pt
]
attention.east
)
$}
\ExtractY
{$
([
yshift
=
2
pt
]
dec
11
.north
)
$}
\coordinate
(tmp1) at (
\XCoord
,
\YCoord
);
\ExtractX
{$
([
xshift
=-
5
pt
]
dec
12
.west
)
$}
\coordinate
(tmp2) at (
\XCoord
,
\YCoord
);
\draw
[-latex',rounded corners=2pt]
([yshift=-3pt]attention.east) -| (tmp1) -- (tmp2) |- ([yshift=3pt]dec12.west);
\ExtractX
{$
([
xshift
=
11
pt
]
attention.east
)
$}
\ExtractY
{$
([
yshift
=
2
pt
]
dec
21
.north
)
$}
\coordinate
(tmp1) at (
\XCoord
,
\YCoord
);
\ExtractX
{$
([
xshift
=-
5
pt
]
dec
22
.west
)
$}
\coordinate
(tmp2) at (
\XCoord
,
\YCoord
);
\draw
[-latex',rounded corners=2pt]
([yshift=-1pt]attention.east) -| (tmp1) -- (tmp2) |- ([yshift=3pt]dec22.west);
\ExtractX
{$
([
xshift
=
13
pt
]
attention.east
)
$}
\ExtractY
{$
([
yshift
=
2
pt
]
dec
31
.north
)
$}
\coordinate
(tmp1) at (
\XCoord
,
\YCoord
);
\ExtractX
{$
([
xshift
=-
5
pt
]
dec
32
.west
)
$}
\coordinate
(tmp2) at (
\XCoord
,
\YCoord
);
\draw
[-latex',rounded corners=2pt]
([yshift=1pt]attention.east) -| (tmp1) -- (tmp2) |- ([yshift=3pt]dec32.west);
\ExtractX
{$
([
xshift
=
15
pt
]
attention.east
)
$}
\ExtractY
{$
([
yshift
=
2
pt
]
dec
51
.north
)
$}
\coordinate
(tmp1) at (
\XCoord
,
\YCoord
);
\ExtractX
{$
([
xshift
=-
5
pt
]
dec
52
.west
)
$}
\coordinate
(tmp2) at (
\XCoord
,
\YCoord
);
\draw
[-latex',rounded corners=2pt]
([yshift=3pt]attention.east) -| (tmp1) -- (tmp2) |- ([yshift=3pt]dec52.west);
% label
\draw
[decorate,decoration={brace}]
([xshift=-5pt]enc11.south west) to node [auto,font=
\scriptsize
,name=label1]
{
8层
}
([xshift=-5pt]enc61.north west);
\draw
[decorate,decoration={brace,mirror}]
([xshift=5pt]dec14.south east) to node [auto,swap,font=
\scriptsize
,name=label2]
{
8层
}
([xshift=5pt]dec54.north east);
\begin{pgfonlayer}
{
background
}
\coordinate
(tmp) at ([xshift=-4pt]label1.west);
\node
[draw,densely dashed,rounded corners=2pt,inner sep=2pt,fit=(label1) (encword1) (attention) (tmp)]
(encoder)
{}
;
\ExtractX
{$
([
xshift
=
4
pt
]
label
2
.east
)
$}
\ExtractY
{$
([
yshift
=
6
pt
]
decoutword
4
.north
)
$}
\coordinate
(tmp) at (
\XCoord
,
\YCoord
);
\node
[draw,densely dashed,rounded corners=2pt,inner sep=2pt,fit=(label2) (decinword1) (decoutword4) (tmp)]
(decoder)
{}
;
\end{pgfonlayer}
\node
[wnode,anchor=north west]
() at (encoder.north west)
{
编码器
}
;
\node
[wnode,anchor=north east]
() at (decoder.north east)
{
解码器
}
;
\end{tikzpicture}
\end{center}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论