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
f2d8a07d
Commit
f2d8a07d
authored
May 10, 2020
by
zengxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chapter6
parent
1621d4cf
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
25 行增加
和
62 行删除
+25
-62
Book/Chapter6/Chapter6.tex
+0
-0
Book/Chapter6/Figures/figure-A-working-example-of-neural-machine-translation.tex
+22
-60
Book/Chapter6/Figures/figure-transformer.tex
+3
-2
没有找到文件。
Book/Chapter6/Chapter6.tex
查看文件 @
f2d8a07d
差异被折叠。
点击展开。
Book/Chapter6/Figures/figure-A-working-example-of-neural-machine-translation.tex
查看文件 @
f2d8a07d
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}
\setlength
{
\base
}{
0.9
cm
}
\setlength
{
\base
}{
1
cm
}
\tikzstyle
{
rnnnode
}
= [rounded corners=1pt,minimum size=0.5
\base
,draw,inner sep=0pt,outer sep=0pt]
\tikzstyle
{
wordnode
}
= [font=
\
script
size
]
\tikzstyle
{
wordnode
}
= [font=
\
footnote
size
]
% RNN translation model
\begin{scope}
[local bounding box=RNNMT]
...
...
@@ -20,7 +14,7 @@
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west]
(eemb
\x
) at ([xshift=0.4
\base
]eemb
\y
.east)
{}
;
\foreach
\x
in
{
1,2,...,4
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(enc
\x
) at ([yshift=0.5
\base
]eemb
\x
.north)
{}
;
\node
[wordnode,left=0.4\base of enc1,font=\
script
size]
(init)
{
0
}
;
\node
[wordnode,left=0.4\base of enc1,font=\
footnote
size]
(init)
{
0
}
;
\node
[wordnode,anchor=east]
(init2) at ([xshift=-3.0em]init.west)
{}
;
{
\node
[rnnnode,fill=purple]
(repr) at (enc4)
{}
;
...
...
@@ -32,50 +26,50 @@
\draw
[->,dashed,thick]
(label.south) -- (enc4.north);
}
\node
[wordnode,below=0pt of eemb1,font=\
script
size]
(encwordin1)
{
我
}
;
\node
[wordnode,below=0pt of eemb2,font=\
script
size]
(encwordin2)
{
很
}
;
\node
[wordnode,below=0pt of eemb3,font=\
script
size]
(encwordin3)
{
好
}
;
\node
[wordnode,below=0pt of eemb4,font=\
script
size]
(encwordin4)
{$
\langle
$
eos
$
\rangle
$}
;
\node
[wordnode,below=0pt of eemb1,font=\
footnote
size]
(encwordin1)
{
我
}
;
\node
[wordnode,below=0pt of eemb2,font=\
footnote
size]
(encwordin2)
{
很
}
;
\node
[wordnode,below=0pt of eemb3,font=\
footnote
size]
(encwordin3)
{
好
}
;
\node
[wordnode,below=0pt of eemb4,font=\
footnote
size]
(encwordin4)
{$
\langle
$
eos
$
\rangle
$}
;
%大括号
\draw
[decorate,thick,decoration={mirror,brace}]
([xshift=0.0em,yshift=-1.5em]eemb1.south west) --([xshift=0.0em,yshift=-1.5em]eemb4.south east) node [font=
\
script
size
,xshift=-3.8em,yshift=-1.0em,align=center](label2)
{
编码器
}
;
\draw
[decorate,thick,decoration={mirror,brace}]
([xshift=0.0em,yshift=-1.5em]eemb1.south west) --([xshift=0.0em,yshift=-1.5em]eemb4.south east) node [font=
\
footnote
size
,xshift=-3.8em,yshift=-1.0em,align=center](label2)
{
编码器
}
;
% RNN Decoder
\foreach
\x
in
{
1,2,...,4
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([xshift=9.
0em,yshift=-3.5
em]enc
\x
.north)
{}
;
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([xshift=9.
5em,yshift=-3.9
em]enc
\x
.north)
{}
;
\foreach
\x
in
{
1,2,...,4
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.5
\base
]demb
\x
.north)
{}
;
\foreach
\x
in
{
1,2,...,4
}
\node
[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south]
(softmax
\x
) at ([yshift=0.5
\base
]dec
\x
.north)
{}
;
% Decoder input words
\node
[wordnode,below=0pt of demb1,font=\
script
size]
(decwordin)
{$
\langle
$
sos
$
\rangle
$}
;
\node
[wordnode,below=0pt of demb1,font=\
footnote
size]
(decwordin)
{$
\langle
$
sos
$
\rangle
$}
;
\ExtractX
{$
(
demb
2
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base,font=\
script
size]
() at (
\XCoord
,
\YCoord
)
{
I
}
;
\node
[wordnode,anchor=base,font=\
footnote
size]
() at (
\XCoord
,
\YCoord
)
{
I
}
;
\ExtractX
{$
(
demb
3
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base,font=\
script
size]
() at (
\XCoord
,
\YCoord
)
{
am
}
;
\node
[wordnode,anchor=base,font=\
footnote
size]
() at (
\XCoord
,
\YCoord
)
{
am
}
;
\ExtractX
{$
(
demb
4
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base,font=\
script
size]
() at (
\XCoord
,
\YCoord
)
{
fine
}
;
\node
[wordnode,anchor=base,font=\
footnote
size]
() at (
\XCoord
,
\YCoord
)
{
fine
}
;
% Decoder output words
\node
[wordnode,above=0pt of softmax1,font=\
script
size]
(decwordout1)
{
I
}
;
\node
[wordnode,above=0pt of softmax1,font=\
footnote
size]
(decwordout1)
{
I
}
;
\ExtractX
{$
(
softmax
2
.north
)
$}
\ExtractY
{$
(
decwordout
1
.base
)
$}
\node
[wordnode,anchor=base,font=\
script
size]
(decwordout2) at (
\XCoord
,
\YCoord
)
{
am
}
;
\node
[wordnode,anchor=base,font=\
footnote
size]
(decwordout2) at (
\XCoord
,
\YCoord
)
{
am
}
;
\ExtractX
{$
(
softmax
3
.north
)
$}
\ExtractY
{$
(
decwordout
1
.base
)
$}
\node
[wordnode,anchor=base,font=\
script
size]
(decwordout3) at (
\XCoord
,
\YCoord
)
{
fine
}
;
\node
[wordnode,anchor=base,font=\
footnote
size]
(decwordout3) at (
\XCoord
,
\YCoord
)
{
fine
}
;
\ExtractX
{$
(
softmax
4
.north
)
$}
\ExtractY
{$
(
decwordout
1
.base
)
$}
\node
[wordnode,anchor=base,font=\
script
size]
(decwordout4) at (
\XCoord
,
\YCoord
)
{$
\langle
$
eos
$
\rangle
$}
;
\node
[wordnode,anchor=base,font=\
footnote
size]
(decwordout4) at (
\XCoord
,
\YCoord
)
{$
\langle
$
eos
$
\rangle
$}
;
%大括号
\draw
[decorate,thick,decoration={brace}]
([xshift=0.0em,yshift=1.3em]softmax1.north west) --([xshift=0.0em,yshift=1.3em]softmax4.north east) node [font=
\
script
size
,xshift=-3.8em,yshift=1.0em,align=center](label1)
{
解码器
}
;
\draw
[decorate,thick,decoration={brace}]
([xshift=0.0em,yshift=1.3em]softmax1.north west) --([xshift=0.0em,yshift=1.3em]softmax4.north east) node [font=
\
footnote
size
,xshift=-3.8em,yshift=1.0em,align=center](label1)
{
解码器
}
;
% Connections
\draw
[-latex']
(init.east) to (enc1.west);
...
...
@@ -92,41 +86,8 @@
}
\coordinate
(bridge) at ([yshift=-1.15
\base
]demb2);
\draw
[-latex']
(enc4.east) -- (dec1.west);
\node
[]
at ([xshift=1.5cm]dec4.east)
{}
;
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
\ No newline at end of file
Book/Chapter6/Figures/figure-transformer.tex
查看文件 @
f2d8a07d
...
...
@@ -62,8 +62,8 @@
\node
[rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=ugreen!70] [fit = (sa1) (res1) (ffn1) (res2)] (box0)
{}
;
\node
[rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=red!60] [fit = (sa2) (res3) (res5)] (box1)
{}
;
\node
[ugreen
] (count) at ([xshift=-1.7
em,yshift=-1em]encoder.south)
{$
6
\times
$}
;
\node
[red
] (count) at ([xshift=11
em,yshift=0em]decoder.south)
{$
\times
6
$}
;
\node
[ugreen
,font=
\scriptsize
] (count) at ([xshift=-1.5
em,yshift=-1em]encoder.south)
{$
6
\times
$}
;
\node
[red
,font=
\scriptsize
] (count) at ([xshift=10.8
em,yshift=0em]decoder.south)
{$
\times
6
$}
;
\end{scope}
\end{tikzpicture}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论