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
单韦乔
Toy-MT-Introduction
Commits
08a776fd
Commit
08a776fd
authored
Mar 10, 2020
by
曹润柘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update chapter6 figures
parent
84ae9eba
显示空白字符变更
内嵌
并排
正在显示
33 个修改的文件
包含
66 行增加
和
68 行删除
+66
-68
Book/Chapter6/Figures/figure-Automatic-generation-of-ancient-poems-based-on-encoder-decoder-framework.tex
+0
-0
Book/Chapter6/Figures/figure-Automatically-generate-instances-of-couplets.tex
+2
-2
Book/Chapter6/Figures/figure-Beam-search-process.tex
+1
-1
Book/Chapter6/Figures/figure-Comparison-of-the-number-of-padding-in-batch.tex
+0
-2
Book/Chapter6/Figures/figure-Decode-the-word-probability-distribution-at-the-first-position.tex
+1
-1
Book/Chapter6/Figures/figure-Decoding-process-based-on-greedy-method.tex
+2
-2
Book/Chapter6/Figures/figure-Double-layer-RNN.tex
+2
-2
Book/Chapter6/Figures/figure-Example-of-automatic-translation-of-classical-Chinese.tex
+4
-4
Book/Chapter6/Figures/figure-Example-of-context-vector-calculation-process.tex
+2
-2
Book/Chapter6/Figures/figure-GRU01.tex
+1
-1
Book/Chapter6/Figures/figure-GRU02.tex
+1
-1
Book/Chapter6/Figures/figure-GRU03.tex
+1
-1
Book/Chapter6/Figures/figure-LSTM01.tex
+1
-1
Book/Chapter6/Figures/figure-LSTM02.tex
+1
-1
Book/Chapter6/Figures/figure-LSTM03.tex
+1
-1
Book/Chapter6/Figures/figure-LSTM04.tex
+1
-1
Book/Chapter6/Figures/figure-Mask-instance-for-future-positions-in-Transformer.tex
+4
-4
Book/Chapter6/Figures/figure-Matrix-Representation-of-Attention-Weights-Between-Chinese-English-Sentence-Pairs.tex
+2
-2
Book/Chapter6/Figures/figure-Position-of-difference-and-layer-regularization-in-the-model.tex
+2
-2
Book/Chapter6/Figures/figure-Position-of-feedforward-neural-network-in-the-model.tex
+2
-2
Book/Chapter6/Figures/figure-Position-of-self-attention-mechanism-in-the-model.tex
+2
-2
Book/Chapter6/Figures/figure-Structure-of-the-network-during-Transformer-training.tex
+2
-2
Book/Chapter6/Figures/figure-Transformer-input-and-position-encoding.tex
+2
-2
Book/Chapter6/Figures/figure-bi-RNN.tex
+2
-2
Book/Chapter6/Figures/figure-convergence&lr.tex
+4
-4
Book/Chapter6/Figures/figure-decode-of-transformer.tex
+3
-3
Book/Chapter6/Figures/figure-lrate-of-transformer.tex
+2
-2
Book/Chapter6/Figures/figure-process06.tex
+1
-1
Book/Chapter6/Figures/figure-self-att-vs-enco-deco-att.tex
+5
-5
Book/Chapter6/Figures/figure-softmax.tex
+2
-2
Book/Chapter6/Figures/figure-structure-of-GNMT.tex
+3
-3
Book/Chapter6/Figures/figure-the-whole-of-LSTM.tex
+5
-5
Book/Chapter6/Figures/figure-transformer.tex
+2
-2
没有找到文件。
Book/Chapter6/Figures/figure-Automatic-generation-of-ancient-poems-based-on-encoder-decoder-framework.tex
查看文件 @
08a776fd
Book/Chapter6/Figures/figure-Automatically-generate-instances-of-couplets.tex
查看文件 @
08a776fd
...
...
@@ -2,8 +2,8 @@
\begin{tikzpicture}
\begin{scope}
\tikzstyle
{
lnode
}
= [minimum height=2.5em,minimum width=12em,inner sep=3pt,rounded corners=2pt,draw=red!75!black,fill=red!5];
\tikzstyle
{
rnode
}
= [minimum height=2.5em,minimum width=12em,inner sep=3pt,rounded corners=2pt,draw=blue!75!black,fill=blue!5];
\tikzstyle
{
lnode
}
= [minimum height=2.5em,minimum width=12em,inner sep=3pt,
very thick,
rounded corners=2pt,draw=red!75!black,fill=red!5];
\tikzstyle
{
rnode
}
= [minimum height=2.5em,minimum width=12em,inner sep=3pt,
very thick,
rounded corners=2pt,draw=blue!75!black,fill=blue!5];
\tikzstyle
{
standard
}
= [rounded corners=3pt]
\node
[lnode,anchor=west] (l1) at (0,0)
{
上联:翠竹千支歌盛世
}
;
...
...
Book/Chapter6/Figures/figure-Beam-search-process.tex
查看文件 @
08a776fd
...
...
@@ -41,7 +41,7 @@
\node
[anchor=west,inner sep=2pt] (o4) at ([xshift=0.3em]o3.east)
{
\scriptsize
{
...
}}
;
}
\node
[wnode,anchor=north] (wt1) at ([yshift=-0.8em]t1.south)
{
\scriptsize
{$
<eos>
$}}
;
\node
[wnode,anchor=north] (wt1) at ([yshift=-0.8em]t1.south)
{
\scriptsize
{$
\langle
$
eos
$
\rangle
$}}
;
{
\node
[wnode,anchor=north] (wt2) at ([yshift=-0.8em]t2.south)
{
\scriptsize
{
Have
}}
;
...
...
Book/Chapter6/Figures/figure-Comparison-of-the-number-of-padding-in-batch.tex
查看文件 @
08a776fd
...
...
@@ -25,5 +25,4 @@
\node
[rectangle,inner sep=0.5em,rounded corners=2pt,very thick,dotted,draw=ugreen!80] [fit = (s1) (s3) (p1) (p3)] (box0)
{}
;
\node
[rectangle,inner sep=0.5em,rounded corners=2pt,very thick,dotted,draw=ugreen!80] [fit = (s4) (s6) (p4) (p5)] (box0)
{}
;
\end{tikzpicture}
\ No newline at end of file
Book/Chapter6/Figures/figure-Decode-the-word-probability-distribution-at-the-first-position.tex
查看文件 @
08a776fd
...
...
@@ -17,7 +17,7 @@
\node
[rnnnode,anchor=south] (s1) at ([yshift=1em]t1.north)
{
\scriptsize
{$
\textbf
{
s
}_
1
$}}
;
}
\node
[wnode,anchor=north] (wt1) at ([yshift=-0.8em]t1.south)
{
\scriptsize
{$
<eos>
$}}
;
\node
[wnode,anchor=north] (wt1) at ([yshift=-0.8em]t1.south)
{
\scriptsize
{$
\langle
$
eos
$
\rangle
$}}
;
{
\node
[rnnnode,anchor=south,fill=blue!20] (o1) at ([yshift=1em]s1.north)
{
\scriptsize
{
softmax
}}
;
...
...
Book/Chapter6/Figures/figure-Decoding-process-based-on-greedy-method.tex
查看文件 @
08a776fd
...
...
@@ -16,7 +16,7 @@
\node
[rnnnode,anchor=west,fill=green!20] (e3) at ([xshift=1em]e2.east)
{
\tiny
{$
e
_
x
()
$}}
;
\node
[anchor=north,inner sep=2pt] (w1) at ([yshift=-0.6em]e1.south)
{
\tiny
{
你
}}
;
\node
[anchor=north,inner sep=2pt] (w2) at ([yshift=-0.8em]e2.south)
{
\tiny
{
...
}}
;
\node
[anchor=north,inner sep=2pt] (w3) at ([yshift=-0.6em]e3.south)
{
\tiny
{$
<eos>
$}}
;
\node
[anchor=north,inner sep=2pt] (w3) at ([yshift=-0.6em]e3.south)
{
\tiny
{$
\langle
$
eos
$
\rangle
$}}
;
\draw
[->] (w1.north) -- ([yshift=-0.1em]e1.south);
\draw
[->] (w3.north) -- ([yshift=-0.1em]e3.south);
...
...
@@ -62,7 +62,7 @@
\node
[anchor=west,inner sep=2pt] (o5) at ([xshift=0.3em]o4.east)
{
\tiny
{
...
}}
;
}
{
\node
[anchor=north,inner sep=2pt] (wt1) at ([yshift=-0.6em]t1.south)
{
\tiny
{$
<eos>
$}}
;
\node
[anchor=north,inner sep=2pt] (wt1) at ([yshift=-0.6em]t1.south)
{
\tiny
{$
\langle
$
eos
$
\rangle
$}}
;
}
{
\node
[anchor=north,inner sep=2pt] (wt2) at ([yshift=-0.6em]t2.south)
{
\tiny
{
Have
}}
;
...
...
Book/Chapter6/Figures/figure-Double-layer-RNN.tex
查看文件 @
08a776fd
...
...
@@ -28,7 +28,7 @@
\node
[wordnode,below=0pt of eemb7]
()
{
怎么
}
;
\node
[wordnode,below=0pt of eemb8]
()
{
走
}
;
\node
[wordnode,below=0pt of eemb9]
()
{
吗
}
;
\node
[wordnode,below=0pt of eemb10]
()
{
EOS
}
;
\node
[wordnode,below=0pt of eemb10]
()
{
$
\langle
$
eos
$
\rangle
$
}
;
% RNN Decoder
\foreach
\x
in
{
1,2,...,10
}
...
...
@@ -98,7 +98,7 @@
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Station
}
;
\ExtractX
{$
(
softmax
10
.north
)
$}
\ExtractY
{$
(
decwordout.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
EOS
}
;
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
$
\langle
$
eos
$
\rangle
$
}
;
% Connections
\draw
[-latex']
(init1.east) to (enc11.west);
...
...
Book/Chapter6/Figures/figure-Example-of-automatic-translation-of-classical-Chinese.tex
查看文件 @
08a776fd
...
...
@@ -3,13 +3,13 @@
\begin{frame}
{}
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=red!5!white,colframe=red!75!black
,boxrule=1pt
]
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=red!5!white,colframe=red!75!black]
{
\small
{
古文:侍卫步军都指挥使、彰信节度使李继勋营于寿州城南,唐刘仁赡伺继勋无备,出兵击之,杀士卒数百人,焚其攻具。
}
}
\end{tcolorbox}
\vspace
{
-0.4em
}
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=blue!5!white,colframe=blue!75!black
,boxrule=1pt
]
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=blue!5!white,colframe=blue!75!black]
{
\small
{
现代文:侍卫步军都指挥使、彰信节度使李继勋在寿州城南扎营,唐刘仁赡窥伺李继勋没有防备,出兵攻打他,杀死士兵几百人,烧毁李继勋的攻城器
}
}
...
...
@@ -17,13 +17,13 @@
\vspace
{
0.2em
}
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=red!5!white,colframe=red!75!black
,boxrule=1pt
]
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=red!5!white,colframe=red!75!black]
{
\small
{
古文:其后人稍稍识之,多延至其家,使为弟子论学。
}
}
\end{tcolorbox}
\vspace
{
-0.4em
}
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=blue!5!white,colframe=blue!75!black
,boxrule=1pt
]
\begin{tcolorbox}
[size=normal,left=2mm,right=1mm,colback=blue!5!white,colframe=blue!75!black]
{
\small
{
现代文:后来的人渐渐认识他,多把他请到家里,让他为弟子讲授学问。
}
}
...
...
Book/Chapter6/Figures/figure-Example-of-context-vector-calculation-process.tex
查看文件 @
08a776fd
...
...
@@ -54,7 +54,7 @@
\node
[srcnode]
(src3) at ([xshift=0.5
\hnode
]src2.south west)
{
\scriptsize
{
learned
}}
;
\node
[srcnode]
(src4) at ([xshift=0.5
\hnode
]src3.south west)
{
\scriptsize
{
nothing
}}
;
\node
[srcnode]
(src5) at ([xshift=0.5
\hnode
]src4.south west)
{
\scriptsize
{
?
}}
;
\node
[srcnode]
(src6) at ([xshift=0.5
\hnode
]src5.south west)
{
\scriptsize
{
EOS
}}
;
\node
[srcnode]
(src6) at ([xshift=0.5
\hnode
]src5.south west)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
% target
\node
[tgtnode]
(tgt1) at (-6.0*0.5*
\hnode
,-1.05*
\hnode
+7.5*0.5*
\hnode
)
{
\scriptsize
{
你
}}
;
...
...
@@ -64,7 +64,7 @@
\node
[tgtnode]
(tgt5) at ([yshift=-0.5
\hnode
]tgt4.north east)
{
\scriptsize
{
学
}}
;
\node
[tgtnode]
(tgt6) at ([yshift=-0.5
\hnode
]tgt5.north east)
{
\scriptsize
{
到
}}
;
\node
[tgtnode]
(tgt7) at ([yshift=-0.5
\hnode
]tgt6.north east)
{
\scriptsize
{
?
}}
;
\node
[tgtnode]
(tgt8) at ([yshift=-0.5
\hnode
]tgt7.north east)
{
\scriptsize
{
EOS
}}
;
\node
[tgtnode]
(tgt8) at ([yshift=-0.5
\hnode
]tgt7.north east)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
\end{scope}
...
...
Book/Chapter6/Figures/figure-GRU01.tex
查看文件 @
08a776fd
...
...
@@ -86,7 +86,7 @@
\node
[]
(tanh) at (aux46)
{}
;
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)]
(GRU)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)]
(GRU)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-GRU02.tex
查看文件 @
08a776fd
...
...
@@ -99,7 +99,7 @@
\node
[]
(tanh) at (aux46)
{}
;
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)]
(GRU)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)]
(GRU)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-GRU03.tex
查看文件 @
08a776fd
...
...
@@ -118,7 +118,7 @@
\end{scope}
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)]
(GRU)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (tanh)]
(GRU)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-LSTM01.tex
查看文件 @
08a776fd
...
...
@@ -93,7 +93,7 @@
\node
[ ]
(o27) at (aux27)
{
}
;
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-LSTM02.tex
查看文件 @
08a776fd
...
...
@@ -108,7 +108,7 @@
\node
[ ]
(o27) at (aux27)
{
}
;
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-LSTM03.tex
查看文件 @
08a776fd
...
...
@@ -125,7 +125,7 @@
\node
[ ]
(o27) at (aux27)
{
}
;
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-LSTM04.tex
查看文件 @
08a776fd
...
...
@@ -144,7 +144,7 @@
\end{scope}
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\end{pgfonlayer}
...
...
Book/Chapter6/Figures/figure-Mask-instance-for-future-positions-in-Transformer.tex
查看文件 @
08a776fd
...
...
@@ -28,7 +28,7 @@
\node
[srcnode]
(src3) at ([xshift=0.5cm]src2.south west)
{
\scriptsize
{
learned
}}
;
\node
[srcnode]
(src4) at ([xshift=0.5cm]src3.south west)
{
\scriptsize
{
nothing
}}
;
\node
[srcnode]
(src5) at ([xshift=0.5cm]src4.south west)
{
\scriptsize
{
?
}}
;
\node
[srcnode]
(src6) at ([xshift=0.5cm]src5.south west)
{
\scriptsize
{
EOS
}}
;
\node
[srcnode]
(src6) at ([xshift=0.5cm]src5.south west)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
% target
\node
[tgtnode]
(tgt1) at (-6.0*0.5*1.0cm,-1.05*1.0cm+5.5*0.5*1.0cm)
{
\scriptsize
{
Have
}}
;
...
...
@@ -36,7 +36,7 @@
\node
[tgtnode]
(tgt3) at ([yshift=-0.5cm]tgt2.north east)
{
\scriptsize
{
learned
}}
;
\node
[tgtnode]
(tgt4) at ([yshift=-0.5cm]tgt3.north east)
{
\scriptsize
{
nothing
}}
;
\node
[tgtnode]
(tgt5) at ([yshift=-0.5cm]tgt4.north east)
{
\scriptsize
{
?
}}
;
\node
[tgtnode]
(tgt6) at ([yshift=-0.5cm]tgt5.north east)
{
\scriptsize
{
EOS
}}
;
\node
[tgtnode]
(tgt6) at ([yshift=-0.5cm]tgt5.north east)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
{
...
...
@@ -60,7 +60,7 @@
\node
[srcnode]
(src3) at ([xshift=0.5cm]src2.south west)
{
\scriptsize
{
learned
}}
;
\node
[srcnode]
(src4) at ([xshift=0.5cm]src3.south west)
{
\scriptsize
{
nothing
}}
;
\node
[srcnode]
(src5) at ([xshift=0.5cm]src4.south west)
{
\scriptsize
{
?
}}
;
\node
[srcnode]
(src6) at ([xshift=0.5cm]src5.south west)
{
\scriptsize
{
EOS
}}
;
\node
[srcnode]
(src6) at ([xshift=0.5cm]src5.south west)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
% target
\node
[tgtnode]
(tgt1) at (5.4*0.5*1.0cm,-1.05*1.0cm+5.5*0.5*1.0cm)
{
\scriptsize
{
Have
}}
;
...
...
@@ -68,7 +68,7 @@
\node
[tgtnode]
(tgt3) at ([yshift=-0.5cm]tgt2.north east)
{
\scriptsize
{
learned
}}
;
\node
[tgtnode]
(tgt4) at ([yshift=-0.5cm]tgt3.north east)
{
\scriptsize
{
nothing
}}
;
\node
[tgtnode]
(tgt5) at ([yshift=-0.5cm]tgt4.north east)
{
\scriptsize
{
?
}}
;
\node
[tgtnode]
(tgt6) at ([yshift=-0.5cm]tgt5.north east)
{
\scriptsize
{
EOS
}}
;
\node
[tgtnode]
(tgt6) at ([yshift=-0.5cm]tgt5.north east)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
}
...
...
Book/Chapter6/Figures/figure-Matrix-Representation-of-Attention-Weights-Between-Chinese-English-Sentence-Pairs.tex
查看文件 @
08a776fd
...
...
@@ -46,7 +46,7 @@
\node
[srcnode]
(src3) at ([xshift=0.6cm]src2.south west)
{
\scriptsize
{
learned
}}
;
\node
[srcnode]
(src4) at ([xshift=0.6cm]src3.south west)
{
\scriptsize
{
nothing
}}
;
\node
[srcnode]
(src5) at ([xshift=0.6cm]src4.south west)
{
\scriptsize
{
?
}}
;
\node
[srcnode]
(src6) at ([xshift=0.6cm]src5.south west)
{
\scriptsize
{
EOS
}}
;
\node
[srcnode]
(src6) at ([xshift=0.6cm]src5.south west)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
% target
\node
[tgtnode]
(tgt1) at (-6.0*0.5*1.2cm,-1.05*1.2cm+7.5*0.5*1.2cm)
{
\scriptsize
{
你
}}
;
...
...
@@ -56,7 +56,7 @@
\node
[tgtnode]
(tgt5) at ([yshift=-0.6cm]tgt4.north east)
{
\scriptsize
{
学
}}
;
\node
[tgtnode]
(tgt6) at ([yshift=-0.6cm]tgt5.north east)
{
\scriptsize
{
到
}}
;
\node
[tgtnode]
(tgt7) at ([yshift=-0.6cm]tgt6.north east)
{
\scriptsize
{
?
}}
;
\node
[tgtnode]
(tgt8) at ([yshift=-0.6cm]tgt7.north east)
{
\scriptsize
{
EOS
}}
;
\node
[tgtnode]
(tgt8) at ([yshift=-0.6cm]tgt7.north east)
{
\scriptsize
{
$
\langle
$
eos
$
\rangle
$
}}
;
\end{scope}
...
...
Book/Chapter6/Figures/figure-Position-of-difference-and-layer-regularization-in-the-model.tex
查看文件 @
08a776fd
...
...
@@ -38,9 +38,9 @@
\node
[outputnode,anchor=south] (o1) at ([yshift=1em]res5.north)
{
\tiny
{$
\textbf
{
Output layer
}$}}
;
\node
[inputnode,anchor=north west] (input2) at ([yshift=-1em]sa2.south west)
{
\tiny
{$
\textbf
{
Embedding
}$}}
;
\node
[posnode,anchor=north east] (pos2) at ([yshift=-1em]sa2.south east)
{
\tiny
{$
\textbf
{
Postion
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
SOS
$
>
$
I am fine
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
sos
$
>
$
I am fine
}$}}
;
\node
[anchor=east] (decoder) at ([xshift=-1em,yshift=-1.5em]o1.west)
{
\scriptsize
{
\textbf
{
解码器
}}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
EOS
$
>
$
}$}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
eos
$
>
$
}$}}
;
\draw
[->] (sa2.north) -- (res3.south);
\draw
[->] (res3.north) -- (ed1.south);
...
...
Book/Chapter6/Figures/figure-Position-of-feedforward-neural-network-in-the-model.tex
查看文件 @
08a776fd
...
...
@@ -36,9 +36,9 @@
\node
[outputnode,anchor=south] (o1) at ([yshift=1em]res5.north)
{
\tiny
{$
\textbf
{
Output layer
}$}}
;
\node
[inputnode,anchor=north west] (input2) at ([yshift=-1em]sa2.south west)
{
\tiny
{$
\textbf
{
Embedding
}$}}
;
\node
[posnode,anchor=north east] (pos2) at ([yshift=-1em]sa2.south east)
{
\tiny
{$
\textbf
{
Postion
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
SOS
$
>
$
I am fine
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
sos
$
>
$
I am fine
}$}}
;
\node
[anchor=east] (decoder) at ([xshift=-1em,yshift=-1.5em]o1.west)
{
\scriptsize
{
\textbf
{
解码器
}}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
EOS
$
>
$
}$}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
eos
$
>
$
}$}}
;
\draw
[->] (sa2.north) -- (res3.south);
\draw
[->] (res3.north) -- (ed1.south);
...
...
Book/Chapter6/Figures/figure-Position-of-self-attention-mechanism-in-the-model.tex
查看文件 @
08a776fd
...
...
@@ -37,9 +37,9 @@
\node
[outputnode,anchor=south] (o1) at ([yshift=1em]res5.north)
{
\tiny
{$
\textbf
{
Output layer
}$}}
;
\node
[inputnode,anchor=north west] (input2) at ([yshift=-1em]sa2.south west)
{
\tiny
{$
\textbf
{
Embedding
}$}}
;
\node
[posnode,anchor=north east] (pos2) at ([yshift=-1em]sa2.south east)
{
\tiny
{$
\textbf
{
Postion
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
SOS
$
>
$
I am fine
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
sos
$
>
$
I am fine
}$}}
;
\node
[anchor=east] (decoder) at ([xshift=-1em,yshift=-1.5em]o1.west)
{
\scriptsize
{
\textbf
{
解码器
}}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
EOS
$
>
$
}$}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
eos
$
>
$
}$}}
;
\draw
[->] (sa2.north) -- (res3.south);
\draw
[->] (res3.north) -- (ed1.south);
...
...
Book/Chapter6/Figures/figure-Structure-of-the-network-during-Transformer-training.tex
查看文件 @
08a776fd
...
...
@@ -14,7 +14,7 @@
\node
[rnnnode,anchor=west,fill=green!20] (e3) at ([xshift=1em]e2.east)
{
\tiny
{$
e
_
x
()
$}}
;
\node
[anchor=north,inner sep=2pt] (w1) at ([yshift=-0.6em]e1.south)
{
\tiny
{
你
}}
;
\node
[anchor=north,inner sep=2pt] (w2) at ([yshift=-0.6em]e2.south)
{
\tiny
{
好
}}
;
\node
[anchor=north,inner sep=2pt] (w3) at ([yshift=-0.6em]e3.south)
{
\tiny
{
<eos>
}}
;
\node
[anchor=north,inner sep=2pt] (w3) at ([yshift=-0.6em]e3.south)
{
\tiny
{
$
\langle
$
eos
$
\rangle
$
}}
;
\node
[anchor=south] (dot1) at ([xshift=0.4em,yshift=-0.7em]h1.south)
{
\tiny
{
...
}}
;
\node
[anchor=south] (dot2) at ([xshift=-0.4em,yshift=-0.7em]h3.south)
{
\tiny
{
...
}}
;
...
...
@@ -56,7 +56,7 @@
\node
[anchor=south,fill=black!5!white,minimum height=1.1em,minimum width=13em,inner sep=2pt,rounded corners=1pt,draw] (loss) at ([xshift=1.8em,yshift=1em]o2.north)
{
\scriptsize
{
\textbf
{
Cross Entropy Loss
}}}
;
}
{
\node
[anchor=north,inner sep=2pt] (wt1) at ([yshift=-0.6em]t1.south)
{
\tiny
{
<eos>
}}
;
\node
[anchor=north,inner sep=2pt] (wt1) at ([yshift=-0.6em]t1.south)
{
\tiny
{
$
\langle
$
eos
$
\rangle
$
}}
;
\node
[anchor=north,inner sep=2pt] (wt2) at ([yshift=-0.6em]t2.south)
{
\tiny
{
How
}}
;
\node
[anchor=north,inner sep=2pt] (wt3) at ([yshift=-0.8em]t3.south)
{
\tiny
{
are
}}
;
\node
[anchor=north,inner sep=2pt] (wt4) at ([yshift=-0.8em]t4.south)
{
\tiny
{
you
}}
;
...
...
Book/Chapter6/Figures/figure-Transformer-input-and-position-encoding.tex
查看文件 @
08a776fd
...
...
@@ -36,9 +36,9 @@
\node
[outputnode,anchor=south] (o1) at ([yshift=1em]res5.north)
{
\tiny
{$
\textbf
{
Output layer
}$}}
;
\node
[inputnode,anchor=north west] (input2) at ([yshift=-1em]sa2.south west)
{
\tiny
{$
\textbf
{
Embedding
}$}}
;
\node
[posnode,anchor=north east] (pos2) at ([yshift=-1em]sa2.south east)
{
\tiny
{$
\textbf
{
Postion
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
SOS
$
>
$
I am fine
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
sos
$
>
$
I am fine
}$}}
;
\node
[anchor=east] (decoder) at ([xshift=-1em,yshift=-1.5em]o1.west)
{
\scriptsize
{
\textbf
{
解码器
}}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
EOS
$
>
$
}$}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
eos
$
>
$
}$}}
;
\draw
[->] (sa2.north) -- (res3.south);
\draw
[->] (res3.north) -- (ed1.south);
...
...
Book/Chapter6/Figures/figure-bi-RNN.tex
查看文件 @
08a776fd
...
...
@@ -43,7 +43,7 @@
\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]
(decwordin)
{
EOS
}
;
\node
[wordnode,below=0pt of demb1]
(decwordin)
{
$
\langle
$
eos
$
\rangle
$
}
;
\ExtractX
{$
(
demb
2
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Do
}
;
...
...
@@ -100,7 +100,7 @@
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Station
}
;
\ExtractX
{$
(
softmax
10
.north
)
$}
\ExtractY
{$
(
decwordout.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
EOS
}
;
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
$
\langle
$
eos
$
\rangle
$
}
;
% Connections
\draw
[-latex']
(init.east) to (enc1.west);
...
...
Book/Chapter6/Figures/figure-convergence&lr.tex
查看文件 @
08a776fd
...
...
@@ -7,8 +7,8 @@
ytick=
{
0,1,...,4
}
,
xticklabel style=
{
opacity=0
}
,
yticklabel style=
{
opacity=0
}
,
xlabel=
{
$
w
$
}
,
ylabel=
{
$
L
(
w
)
$
}
,
xlabel=
{
\textbf
{$
\textrm
{
W
}_
t
$}
}
,
ylabel=
{
\textbf
{
L(
$
\textrm
{
W
}_
t
$
)
}
}
,
axis line style=
{
->
}
,
xlabel style=
{
xshift=2.2cm,yshift=1.2cm
}
,
ylabel style=
{
rotate=-90,xshift=1.5cm,yshift=1.6cm
}
,
...
...
@@ -34,8 +34,8 @@
ytick=
{
0,1,...,4
}
,
xticklabel style=
{
opacity=0
}
,
yticklabel style=
{
opacity=0
}
,
xlabel=
{
$
w
$
}
,
ylabel=
{
$
L
(
w
)
$
}
,
xlabel=
{
\textbf
{$
\textrm
{
W
}_
t
$}
}
,
ylabel=
{
\textbf
{
L(
$
\textrm
{
W
}_
t
$
)
}
}
,
axis line style=
{
->
}
,
xlabel style=
{
xshift=2.2cm,yshift=1.2cm
}
,
ylabel style=
{
rotate=-90,xshift=1.5cm,yshift=1.6cm
}
,
...
...
Book/Chapter6/Figures/figure-decode-of-transformer.tex
查看文件 @
08a776fd
...
...
@@ -13,7 +13,7 @@
\node
[rnnnode,anchor=west,fill=green!20] (e3) at ([xshift=1em]e2.east)
{
\tiny
{$
e
_
x
()
$}}
;
\node
[anchor=north,inner sep=2pt] (w1) at ([yshift=-0.6em]e1.south)
{
\tiny
{
你
}}
;
\node
[anchor=north,inner sep=2pt] (w2) at ([yshift=-0.6em]e2.south)
{
\tiny
{
好
}}
;
\node
[anchor=north,inner sep=2pt] (w3) at ([yshift=-0.6em]e3.south)
{
\tiny
{
<eos>
}}
;
\node
[anchor=north,inner sep=2pt] (w3) at ([yshift=-0.6em]e3.south)
{
\tiny
{
$
\langle
$
eos
$
\rangle
$
}}
;
%\node [anchor=south] (dot1) at ([xshift=0.4em,yshift=-0.7em]h1.south) {\tiny{...}};
%\node [anchor=south] (dot2) at ([xshift=-0.4em,yshift=-0.7em]h3.south) {\tiny{...}};
...
...
@@ -73,7 +73,7 @@
%\node [anchor=west,inner sep=2pt] (o5) at ([xshift=0.3em]o4.east) {\tiny{...}};
}
{
\node
[anchor=north,inner sep=2pt] (wt1) at ([yshift=-0.6em]t1.south)
{
\tiny
{
<eos>
}}
;
\node
[anchor=north,inner sep=2pt] (wt1) at ([yshift=-0.6em]t1.south)
{
\tiny
{
$
\langle
$
eos
$
\rangle
$
}}
;
}
{
\node
[anchor=north,inner sep=2pt] (wt2) at ([yshift=-0.6em]t2.south)
{
\tiny
{
How
}}
;
...
...
@@ -97,7 +97,7 @@
{
\node
[anchor=center,inner sep=2pt] (wo3) at ([yshift=1.2em]o3.north)
{
\tiny
{
you
}}
;
\node
[anchor=south,inner sep=2pt] (wos3) at (wo3.north)
{
\tiny
{
\textbf
{
[step 3]
}}}
;
\node
[anchor=center,inner sep=2pt] (wo4) at ([yshift=1.2em]o4.north)
{
\tiny
{
<eos>
}}
;
\node
[anchor=center,inner sep=2pt] (wo4) at ([yshift=1.2em]o4.north)
{
\tiny
{
$
\langle
$
eos
$
\rangle
$
}}
;
\node
[anchor=south,inner sep=2pt] (wos4) at (wo4.north)
{
\tiny
{
\textbf
{
[step 4]
}}}
;
}
...
...
Book/Chapter6/Figures/figure-lrate-of-transformer.tex
查看文件 @
08a776fd
...
...
@@ -7,8 +7,8 @@
width=.60
\textwidth
,
height=.40
\textwidth
,
legend style=
{
at=
{
(0.60,0.08)
}
, anchor=south west
}
,
xlabel=
{
\footnotesize
{
更新步数
(10k)
}}
,
ylabel=
{
\footnotesize
{
学习率
(
\scriptsize
{$
10
^{
-
3
}$
)
}}}
,
xlabel=
{
\footnotesize
{
num update
(10k)
}}
,
ylabel=
{
\footnotesize
{
Learn rate
(
\scriptsize
{$
10
^{
-
3
}$
)
}}}
,
ylabel style=
{
yshift=-1em
}
,xlabel style=
{
yshift=0.0em
}
,
yticklabel style=
{
/pgf/number format/precision=2,/pgf/number format/fixed zerofill
}
,
ymin=0,ymax=0.9, ytick=
{
0.2, 0.4, 0.6, 0.8
}
,
...
...
Book/Chapter6/Figures/figure-process06.tex
查看文件 @
08a776fd
...
...
@@ -83,7 +83,7 @@
% step 6
{
\node
[rnnnode]
(rnn34) at ([xshift=2
\base
]rnn33)
{}
;
\node
[wordnode,anchor=south]
(o4) at ([yshift=
\base
]rnn34.north)
{
EOS
}
;
\node
[wordnode,anchor=south]
(o4) at ([yshift=
\base
]rnn34.north)
{
$
\langle
$
eos
$
\rangle
$
}
;
\draw
[-latex']
(rnn33) to (rnn34);
\draw
[-latex']
(rnn24) to (rnn34);
\draw
[-latex']
(rnn34) to (o4);
...
...
Book/Chapter6/Figures/figure-self-att-vs-enco-deco-att.tex
查看文件 @
08a776fd
...
...
@@ -13,11 +13,11 @@
\node
[anchor=north,rounded corners=1pt,minimum width=11.0em,minimum height=3.5em,draw=ugreen!70,very thick,dotted]
(p1-1) at ([yshift=-5.2em]p1.south)
{
\small
{
解码端每个位置的表示
}}
;
\draw
[->,thick,dashed] (word3.south) .. controls +(south:1
.5em) and +(north:1.5em) .. ([xshift=-0.4em]
p1-1.north);
\draw
[->,thick,dashed] (word3.south) .. controls +(south:1
em) and +(north:1em) .. (
p1-1.north);
\draw
[->,thick,dashed](word1.south) --(p1-1.north);
\draw
[->,thick,dashed] (word2.south) .. controls +(south:1
.0em) and +(north:1.5em) .. ([xshift=0.4em]
p1-1.north);
\draw
[->,thick,dashed] (word2.south) .. controls +(south:1
em) and +(north:1em) .. (
p1-1.north);
\node
[anchor=north]
(caption1) at ([xshift=0.0em,yshift=-9.5em]p1.south)
{
\small
{
(a)
Self-Attention的输入
}}
;
\node
[anchor=north]
(caption1) at ([xshift=0.0em,yshift=-9.5em]p1.south)
{
\small
{
(a)Self-Attention的输入
}}
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node
[anchor=west,rounded corners=1pt,minimum width=14.0em,minimum height=2.0em,fill=pink!30,draw=black]
(p2) at ([xshift=5.0em]p1.east)
{
\small
{
Encoder-Decoder Attention
}}
;
...
...
@@ -48,10 +48,10 @@
\draw
[<-,thick,dashed]
([xshift=-3.6em,yshift=-3.2em]word1-2.north)--([xshift=-3.6em,yshift=-3.2em]p2.south);
\draw
[<-,thick,dashed]
([xshift=3.6em,yshift=-3.2em]word1-2.north)--([xshift=3.6em,yshift=-3.2em]p2.south);
\draw
[->,thick,dashed] (word1-2.south) .. controls +(south:1em) and +(north:1
.5em) .. ([yshift=0.3em,xshift=-0.4
em]p2-3.north);
\draw
[->,thick,dashed] (word1-2.south) .. controls +(south:1em) and +(north:1
em) .. ([yshift=0.3
em]p2-3.north);
\node
[anchor=north]
(caption2) at ([xshift=0.0em,yshift=-9.5em]p2.south)
{
\small
{
(b)
Encoder-Decoder Attention的输入
}}
;
\node
[anchor=north]
(caption2) at ([xshift=0.0em,yshift=-9.5em]p2.south)
{
\small
{
(b)Encoder-Decoder Attention的输入
}}
;
...
...
Book/Chapter6/Figures/figure-softmax.tex
查看文件 @
08a776fd
...
...
@@ -4,8 +4,8 @@
width=8cm, height=5cm,
xtick=
{
-6,-4,...,6
}
,
ytick=
{
0,0.5,1
}
,
xlabel=
{
\small
{
$
x
$
}}
,
ylabel=
{
\small
{
Softmax(
$
x
$
)
}}
,
xlabel=
{
\small
{
\textbf
{
x
}
}}
,
ylabel=
{
\small
{
\textbf
{
Softmax(x)
}
}}
,
xlabel style=
{
xshift=3.0cm,yshift=1cm
}
,
axis y line=middle,
ylabel style=
{
xshift=-2.4cm,yshift=-0.2cm
}
,
...
...
Book/Chapter6/Figures/figure-structure-of-GNMT.tex
查看文件 @
08a776fd
...
...
@@ -40,7 +40,7 @@
% words
\node
[wnode,below=0pt of encemb1]
(encword1)
{
你
}
;
\node
[wnode,below=0pt of encemb2]
(encword2)
{
什么
}
;
\node
[wnode,below=0pt of encemb4]
(encword4)
{
EOS
}
;
\node
[wnode,below=0pt of encemb4]
(encword4)
{
$
\langle
$
eos
$
\rangle
$
}
;
% connections
\draw
[-latex']
(enc11) to (enc12);
...
...
@@ -139,7 +139,7 @@
\node
[rnnnode,fill=blue!20,above=\base of dec54]
(softmax4)
{}
;
% words
\node
[wnode,below=0pt of decemb1]
(decinword1)
{
SOS
}
;
\node
[wnode,below=0pt of decemb1]
(decinword1)
{
$
\langle
$
sos
$
\rangle
$
}
;
\node
[wnode,below=0pt of decemb2]
(decinword2)
{
Have
}
;
\node
[wnode,below=0pt of decemb4]
(decinword4)
{
?
}
;
...
...
@@ -149,7 +149,7 @@
\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
}
;
\node
[wnode,anchor=base]
(decoutword4) at (
\XCoord
,
\YCoord
)
{
$
\langle
$
eos
$
\rangle
$
}
;
% connections
\draw
[-latex']
(dec11) to (dec12);
...
...
Book/Chapter6/Figures/figure-the-whole-of-LSTM.tex
查看文件 @
08a776fd
...
...
@@ -154,25 +154,25 @@
\end{scope}
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!
1
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\node
[draw,very thick,rectangle,fill=blue!
3
0!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)]
(LSTM)
{}
;
\end{pgfonlayer}
\begin{scope}
{
% forget gate formula
\node
[formulanode,anchor=south east,text width=
10e
m]
() at ([shift=
{
(4
\base
,1.5
\base
)
}
]aux51)
{
遗忘门
\\
$
\mathbf
{
f
}_
t
=
\sigma
(
\mathbf
{
W
}_
f
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
f
)
$}
;
\node
[formulanode,anchor=south east,text width=
3.4c
m]
() at ([shift=
{
(4
\base
,1.5
\base
)
}
]aux51)
{
遗忘门
\\
$
\mathbf
{
f
}_
t
=
\sigma
(
\mathbf
{
W
}_
f
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
f
)
$}
;
}
{
% input gate formula
\node
[formulanode,anchor=north east
,text width=10em
]
() at ([shift=
{
(4
\base
,-1.5
\base
)
}
]aux21)
{
输入门
\\
$
\mathbf
{
i
}_
t
=
\sigma
(
\mathbf
{
W
}_
i
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
i
)
$
\\
$
\hat
{
\mathbf
{
c
}}_
t
=
\mathrm
{
tanh
}
(
\mathbf
{
W
}_
c
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
c
)
$}
;
\node
[formulanode,anchor=north east]
() at ([shift=
{
(4
\base
,-1.5
\base
)
}
]aux21)
{
输入门
\\
$
\mathbf
{
i
}_
t
=
\sigma
(
\mathbf
{
W
}_
i
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
i
)
$
\\
$
\hat
{
\mathbf
{
c
}}_
t
=
\mathrm
{
tanh
}
(
\mathbf
{
W
}_
c
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
c
)
$}
;
}
{
% cell update formula
\node
[formulanode,anchor=south west,text width=
10e
m]
() at ([shift=
{
(-4
\base
,1.5
\base
)
}
]aux59)
{
记忆更新
\\
$
\mathbf
{
c
}_{
t
}
=
\mathbf
{
f
}_
t
\cdot
\mathbf
{
c
}_{
t
-
1
}
+
\mathbf
{
i
}_
t
\cdot
\hat
{
\mathbf
{
c
}}_
t
$}
;
\node
[formulanode,anchor=south west,text width=
3.02c
m]
() at ([shift=
{
(-4
\base
,1.5
\base
)
}
]aux59)
{
记忆更新
\\
$
\mathbf
{
c
}_{
t
}
=
\mathbf
{
f
}_
t
\cdot
\mathbf
{
c
}_{
t
-
1
}
+
\mathbf
{
i
}_
t
\cdot
\hat
{
\mathbf
{
c
}}_
t
$}
;
}
{
% output gate formula
\node
[formulanode,anchor=north west
,text width=10em
]
() at ([shift=
{
(-4
\base
,-1.5
\base
)
}
]aux29)
{
输出门
\\
$
\mathbf
{
o
}_
t
=
\sigma
(
\mathbf
{
W
}_
o
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
o
)
$
\\
$
\mathbf
{
h
}_{
t
}
=
\mathbf
{
o
}_
t
\cdot
\mathrm
{
tanh
}
(
\mathbf
{
c
}_{
t
}
)
$}
;
\node
[formulanode,anchor=north west]
() at ([shift=
{
(-4
\base
,-1.5
\base
)
}
]aux29)
{
输出门
\\
$
\mathbf
{
o
}_
t
=
\sigma
(
\mathbf
{
W
}_
o
[
\mathbf
{
h
}_{
t
-
1
}
,
\mathbf
{
x
}_
t
]+
\mathbf
{
b
}_
o
)
$
\\
$
\mathbf
{
h
}_{
t
}
=
\mathbf
{
o
}_
t
\cdot
\mathrm
{
tanh
}
(
\mathbf
{
c
}_{
t
}
)
$}
;
}
\end{scope}
\end{tikzpicture}
...
...
Book/Chapter6/Figures/figure-transformer.tex
查看文件 @
08a776fd
...
...
@@ -35,9 +35,9 @@
\node
[outputnode,anchor=south] (o1) at ([yshift=1em]res5.north)
{
\tiny
{$
\textbf
{
Output layer
}$}}
;
\node
[inputnode,anchor=north west] (input2) at ([yshift=-1em]sa2.south west)
{
\tiny
{$
\textbf
{
Embedding
}$}}
;
\node
[posnode,anchor=north east] (pos2) at ([yshift=-1em]sa2.south east)
{
\tiny
{$
\textbf
{
Postion
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
SOS
$
>
$
I am fine
}$}}
;
\node
[anchor=north] (outputs) at ([yshift=-3em]sa2.south)
{
\tiny
{$
\textbf
{
解码器输入:
$
<
$
sos
$
>
$
I am fine
}$}}
;
\node
[anchor=east] (decoder) at ([xshift=-1em,yshift=-1.5em]o1.west)
{
\scriptsize
{
\textbf
{
解码器
}}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
EOS
$
>
$
}$}}
;
\node
[anchor=north] (decoutputs) at ([yshift=1.5em]o1.north)
{
\tiny
{$
\textbf
{
解码器输出: I am fine
$
<
$
eos
$
>
$
}$}}
;
\draw
[->] (sa2.north) -- (res3.south);
\draw
[->] (res3.north) -- (ed1.south);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论