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
fc60356e
Commit
fc60356e
authored
Nov 26, 2020
by
zengxin
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'zengxin' 到 'caorunzhe'
Zengxin 查看合并请求
!486
parents
4d380108
d457080c
全部展开
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
90 行增加
和
80 行删除
+90
-80
Chapter10/Figures/figure-3-base-problom-of-p.tex
+4
-4
Chapter10/Figures/figure-bi-rnn.tex
+1
-1
Chapter10/Figures/figure-gru01.tex
+2
-2
Chapter10/Figures/figure-gru02.tex
+2
-2
Chapter10/Figures/figure-gru03.tex
+2
-2
Chapter10/Figures/figure-lstm02.tex
+1
-1
Chapter10/Figures/figure-lstm03.tex
+2
-2
Chapter10/Figures/figure-lstm04.tex
+3
-3
Chapter10/Figures/figure-the-whole-of-lstm.tex
+6
-6
Chapter10/chapter10.tex
+0
-0
Chapter11/Figures/figure-average-pooling.tex
+20
-17
Chapter11/Figures/figure-fairseq-0.tex
+2
-2
Chapter11/Figures/figure-fairseq-2.tex
+2
-2
Chapter11/Figures/figure-fairseq-3.tex
+2
-2
Chapter11/Figures/figure-image-convolution.tex
+3
-3
Chapter11/Figures/figure-max-pooling.tex
+6
-3
Chapter11/Figures/figure-use-cnn-in-sentence-classification.tex
+29
-25
Chapter11/chapter11.tex
+0
-0
Chapter12/chapter12.tex
+3
-3
没有找到文件。
Chapter10/Figures/figure-3-base-problom-of-p.tex
查看文件 @
fc60356e
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
% RNN Encoder
% RNN Encoder
\coordinate
(eemb0) at (0,0);
\coordinate
(eemb0) at (0,0);
\foreach
\x
[count=
\y
from 0] in
{
1,2,...,3
}
\foreach
\x
[count=
\y
from 0] in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west]
(eemb
\x
) at ([xshift=0.4
\base
]eemb
\y
.east)
{
\tiny
{$
e
_
x
()
$}}
;
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west]
(eemb
\x
) at ([xshift=0.4
\base
]eemb
\y
.east)
{
\tiny
{$
\textrm
{
e
}
_
x
()
$}}
;
\foreach
\x
in
{
1,2,...,3
}
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(enc
\x
) at ([yshift=0.3
\base
]eemb
\x
.north)
{}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(enc
\x
) at ([yshift=0.3
\base
]eemb
\x
.north)
{}
;
\node
[]
(enclabel1) at (enc1)
{
\tiny
{$
\mathbi
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel1) at (enc1)
{
\tiny
{$
\mathbi
{
h
}_{
m
-
2
}$}}
;
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
% RNN Decoder
% RNN Decoder
\foreach
\x
in
{
1,2,...,3
}
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([yshift=
\base
]enc
\x
.north)
{
\tiny
{$
e
_
y
()
$}}
;
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([yshift=
\base
]enc
\x
.north)
{
\tiny
{$
\textrm
{
e
}
_
y
()
$}}
;
\foreach
\x
in
{
1,2,...,3
}
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.3
\base
]demb
\x
.north)
{{
\tiny
{$
\mathbi
{
s
}_
\x
$}}}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.3
\base
]demb
\x
.north)
{{
\tiny
{$
\mathbi
{
s
}_
\x
$}}}
;
\foreach
\x
in
{
1,2,...,3
}
\foreach
\x
in
{
1,2,...,3
}
...
@@ -80,10 +80,10 @@
...
@@ -80,10 +80,10 @@
}
}
{
{
\node
[anchor=north west] (line11) at ([yshift=-1.8em]line4.west)
{
\scriptsize
{
每个词的
o
ne-hot
}}
;
\node
[anchor=north west] (line11) at ([yshift=-1.8em]line4.west)
{
\scriptsize
{
每个词的
O
ne-hot
}}
;
\node
[anchor=north west] (line12) at ([yshift=0.3em]line11.south west)
{
\scriptsize
{
离散化表示都被转化为
\ \ \ \
}}
;
\node
[anchor=north west] (line12) at ([yshift=0.3em]line11.south west)
{
\scriptsize
{
离散化表示都被转化为
\ \ \ \
}}
;
\node
[anchor=north west] (line13) at ([yshift=0.3em]line12.south west)
{
\scriptsize
{
实数向量,即词嵌入
}}
;
\node
[anchor=north west] (line13) at ([yshift=0.3em]line12.south west)
{
\scriptsize
{
实数向量,即词嵌入
}}
;
\node
[anchor=north west] (line14) at ([yshift=0.3em]line13.south west)
{
\scriptsize
{
(
$
e
_
x
()
$
和
$
e
_
y
()
$
函数)
}}
;
\node
[anchor=north west] (line14) at ([yshift=0.3em]line13.south west)
{
\scriptsize
{
(
$
\textrm
{
e
}_
x
()
$
和
$
\textrm
{
e
}
_
y
()
$
函数)
}}
;
}
}
{
{
...
...
Chapter10/Figures/figure-bi-rnn.tex
查看文件 @
fc60356e
...
@@ -43,7 +43,7 @@
...
@@ -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)
{}
;
\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
% Decoder input words
\node
[wordnode,below=0pt of demb1]
(decwordin)
{$
\langle
$
e
os
$
\rangle
$}
;
\node
[wordnode,below=0pt of demb1]
(decwordin)
{$
\langle
$
s
os
$
\rangle
$}
;
\ExtractX
{$
(
demb
2
.south
)
$}
\ExtractX
{$
(
demb
2
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Do
}
;
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Do
}
;
...
...
Chapter10/Figures/figure-gru01.tex
查看文件 @
fc60356e
...
@@ -83,10 +83,10 @@
...
@@ -83,10 +83,10 @@
\end{scope}
\end{scope}
\node
[]
(
t
anh) at (aux46)
{}
;
\node
[]
(
T
anh) at (aux46)
{}
;
\begin{pgfonlayer}
{
background
}
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (
t
anh)]
(GRU)
{}
;
\node
[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (
T
anh)]
(GRU)
{}
;
\end{pgfonlayer}
\end{pgfonlayer}
...
...
Chapter10/Figures/figure-gru02.tex
查看文件 @
fc60356e
...
@@ -96,10 +96,10 @@
...
@@ -96,10 +96,10 @@
\end{scope}
\end{scope}
\node
[]
(
t
anh) at (aux46)
{}
;
\node
[]
(
T
anh) at (aux46)
{}
;
\begin{pgfonlayer}
{
background
}
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (
t
anh)]
(GRU)
{}
;
\node
[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (
T
anh)]
(GRU)
{}
;
\end{pgfonlayer}
\end{pgfonlayer}
...
...
Chapter10/Figures/figure-gru03.tex
查看文件 @
fc60356e
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
\draw
[-latex,emph]
(aux71) -| (aux87);
\draw
[-latex,emph]
(aux71) -| (aux87);
\draw
[-latex,emph]
(aux71) -| (aux53) -- (aux23) -| (aux46) -- (z76);
\draw
[-latex,emph]
(aux71) -| (aux53) -- (aux23) -| (aux46) -- (z76);
\draw
[emph]
(aux12) |- (aux23) -| (aux46);
\draw
[emph]
(aux12) |- (aux23) -| (aux46);
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
(
tanh) at (aux46)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
(
Tanh) at (aux46)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle,draw=red,thick]
(a1) at (aux53)
{}
;
\node
[opnode,circle,draw=red,thick]
(a1) at (aux53)
{}
;
\node
[opnode,circle,draw=red,thick]
(a2) at (aux56)
{}
;
\node
[opnode,circle,draw=red,thick]
(a2) at (aux56)
{}
;
\node
[opnode,circle,draw=red,thick]
(a3) at (aux75)
{}
;
\node
[opnode,circle,draw=red,thick]
(a3) at (aux75)
{}
;
...
@@ -118,7 +118,7 @@
...
@@ -118,7 +118,7 @@
\end{scope}
\end{scope}
\begin{pgfonlayer}
{
background
}
\begin{pgfonlayer}
{
background
}
\node
[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (
t
anh)]
(GRU)
{}
;
\node
[draw,very thick,rectangle,fill=blue!10!white,rounded corners=5pt,inner sep=6pt,fit=(aux22) (aux76) (z76) (
T
anh)]
(GRU)
{}
;
\end{pgfonlayer}
\end{pgfonlayer}
%%new
%%new
...
...
Chapter10/Figures/figure-lstm02.tex
查看文件 @
fc60356e
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{}
;
}
}
\end{scope}
\end{scope}
...
...
Chapter10/Figures/figure-lstm03.tex
查看文件 @
fc60356e
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{
X
}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{
X
}
;
}
}
{
{
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
\draw
[-latex,standard]
(aux21) -- (aux24) |- (i45);
\draw
[-latex,standard]
(aux21) -- (aux24) |- (i45);
\draw
[-latex,standard]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,standard]
(aux21) -- (aux25) -- (u55);
\node
[opnode,circle]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle]
(i45) at (aux45)
{}
;
\node
[opnode,circle]
(i45) at (aux45)
{}
;
}
}
% cell update
% cell update
...
...
Chapter10/Figures/figure-lstm04.tex
查看文件 @
fc60356e
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{
X
}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{
X
}
;
}
}
{
{
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
\draw
[-latex,standard]
(aux21) -- (aux24) |- (i45);
\draw
[-latex,standard]
(aux21) -- (aux24) |- (i45);
\draw
[-latex,standard]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,standard]
(aux21) -- (aux25) -- (u55);
\node
[opnode,circle]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle]
(i45) at (aux45)
{}
;
\node
[opnode,circle]
(i45) at (aux45)
{}
;
}
}
% cell update
% cell update
...
@@ -122,7 +122,7 @@
...
@@ -122,7 +122,7 @@
\draw
[-latex,emph]
(aux21) -- (o27);
\draw
[-latex,emph]
(aux21) -- (o27);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\node
[opnode,circle,draw=red,thick]
() at (aux26)
{$
\sigma
$}
;
\node
[opnode,circle,draw=red,thick]
() at (aux26)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux37)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux37)
{$
\mathrm
{
T
anh
}$}
;
\draw
[-latex,emph]
(o27) -- (aux29);
\draw
[-latex,emph]
(o27) -- (aux29);
\draw
[-latex,emph]
(o27) -| (aux68);
\draw
[-latex,emph]
(o27) -| (aux68);
...
...
Chapter10/Figures/figure-the-whole-of-lstm.tex
查看文件 @
fc60356e
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,emph]
(aux21) -- (aux25) -- (u55);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle,draw=red,thick]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{}
;
\node
[opnode,circle,draw=red,thick]
(i45) at (aux45)
{}
;
}
}
{
{
...
@@ -102,7 +102,7 @@
...
@@ -102,7 +102,7 @@
\draw
[-latex,standard]
(aux21) -- (aux24) |- (i45);
\draw
[-latex,standard]
(aux21) -- (aux24) |- (i45);
\draw
[-latex,standard]
(aux21) -- (aux25) -- (u55);
\draw
[-latex,standard]
(aux21) -- (aux25) -- (u55);
\node
[opnode,circle]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,circle]
() at (aux34)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux35)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux35)
{$
\mathrm
{
T
anh
}$}
;
\node
[opnode,circle]
(i45) at (aux45)
{}
;
\node
[opnode,circle]
(i45) at (aux45)
{}
;
}
}
% cell update
% cell update
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
\draw
[-latex,emph]
(aux21) -- (o27);
\draw
[-latex,emph]
(aux21) -- (o27);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\draw
[emph]
(aux12) -- (aux22) -- (aux23);
\node
[opnode,circle,draw=red,thick]
() at (aux26)
{$
\sigma
$}
;
\node
[opnode,circle,draw=red,thick]
() at (aux26)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux37)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick]
() at (aux37)
{$
\mathrm
{
T
anh
}$}
;
\draw
[-latex,emph]
(o27) -- (aux29);
\draw
[-latex,emph]
(o27) -- (aux29);
\draw
[-latex,emph]
(o27) -| (aux68);
\draw
[-latex,emph]
(o27) -| (aux68);
...
@@ -133,7 +133,7 @@
...
@@ -133,7 +133,7 @@
\draw
[-latex,standard]
(u55) -| (o27);
\draw
[-latex,standard]
(u55) -| (o27);
\draw
[-latex,standard]
(aux21) -- (o27);
\draw
[-latex,standard]
(aux21) -- (o27);
\node
[opnode,circle]
() at (aux26)
{$
\sigma
$}
;
\node
[opnode,circle]
() at (aux26)
{$
\sigma
$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux37)
{$
\mathrm
{
t
anh
}$}
;
\node
[opnode,rectangle,rounded corners=2pt,inner sep=2pt]
() at (aux37)
{$
\mathrm
{
T
anh
}$}
;
\draw
[-latex,standard]
(o27) -- (aux29);
\draw
[-latex,standard]
(o27) -- (aux29);
\draw
[-latex,standard]
(o27) -| (aux68);
\draw
[-latex,standard]
(o27) -| (aux68);
...
@@ -174,7 +174,7 @@
...
@@ -174,7 +174,7 @@
}
}
{
{
% input gate formula
% input gate formula
\node
[formulanode,anchor=north east,text width=10em]
() at ([shift=
{
(4
\base
,-1.5
\base
)
}
]aux21)
{
输入门
\\
$
\mathbi
{
i
}_
t
=
\sigma
(
\mathbi
{
W
}_
i
[
\mathbi
{
h
}_{
t
-
1
}
,
\mathbi
{
x
}_
t
]+
\mathbi
{
b
}_
i
)
$
\\
$
\hat
{
\mathbi
{
c
}}_
t
=
\mathrm
{
t
anh
}
(
\mathbi
{
W
}_
c
[
\mathbi
{
h
}_{
t
-
1
}
,
\mathbi
{
x
}_
t
]+
\mathbi
{
b
}_
c
)
$}
;
\node
[formulanode,anchor=north east,text width=10em]
() at ([shift=
{
(4
\base
,-1.5
\base
)
}
]aux21)
{
输入门
\\
$
\mathbi
{
i
}_
t
=
\sigma
(
\mathbi
{
W
}_
i
[
\mathbi
{
h
}_{
t
-
1
}
,
\mathbi
{
x
}_
t
]+
\mathbi
{
b
}_
i
)
$
\\
$
\hat
{
\mathbi
{
c
}}_
t
=
\mathrm
{
T
anh
}
(
\mathbi
{
W
}_
c
[
\mathbi
{
h
}_{
t
-
1
}
,
\mathbi
{
x
}_
t
]+
\mathbi
{
b
}_
c
)
$}
;
}
}
{
{
% cell update formula
% cell update formula
...
@@ -182,7 +182,7 @@
...
@@ -182,7 +182,7 @@
}
}
{
{
% output gate formula
% output gate formula
\node
[formulanode,anchor=north west,text width=10em]
() at ([shift=
{
(-4
\base
,-1.5
\base
)
}
]aux29)
{
输出门
\\
$
\mathbi
{
o
}_
t
=
\sigma
(
\mathbi
{
W
}_
o
[
\mathbi
{
h
}_{
t
-
1
}
,
\mathbi
{
x
}_
t
]+
\mathbi
{
b
}_
o
)
$
\\
$
\mathbi
{
h
}_{
t
}
=
\mathbi
{
o
}_
t
\cdot
\mathrm
{
t
anh
}
(
\mathbi
{
c
}_{
t
}
)
$}
;
\node
[formulanode,anchor=north west,text width=10em]
() at ([shift=
{
(-4
\base
,-1.5
\base
)
}
]aux29)
{
输出门
\\
$
\mathbi
{
o
}_
t
=
\sigma
(
\mathbi
{
W
}_
o
[
\mathbi
{
h
}_{
t
-
1
}
,
\mathbi
{
x
}_
t
]+
\mathbi
{
b
}_
o
)
$
\\
$
\mathbi
{
h
}_{
t
}
=
\mathbi
{
o
}_
t
\cdot
\mathrm
{
T
anh
}
(
\mathbi
{
c
}_{
t
}
)
$}
;
}
}
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
...
...
Chapter10/chapter10.tex
查看文件 @
fc60356e
差异被折叠。
点击展开。
Chapter11/Figures/figure-average-pooling.tex
查看文件 @
fc60356e
...
@@ -2,29 +2,32 @@
...
@@ -2,29 +2,32 @@
\begin{tikzpicture}
[node distance = 0cm]
\begin{tikzpicture}
[node distance = 0cm]
\node
(num1)[num,fill=red!10]
{
0
}
;
\node
(num1)[num,fill=red!10]
{
1
}
;
\node
(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]
{
0
}
;
\node
(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]
{
5
}
;
\node
(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]
{
0
}
;
\node
(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]
{
0
}
;
\node
(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]
{
0
}
;
\node
(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]
{
6
}
;
\node
(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]
{
1
}
;
\node
(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]
{
3
}
;
\node
(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]
{
4
}
;
\node
(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]
{
3
}
;
\node
(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]
{
7
}
;
\node
(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]
{
1
}
;
\node
(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]
{
5
}
;
\node
(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]
{
7
}
;
\node
(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]
{
8
}
;
\node
(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]
{
7
}
;
\node
(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]
{
6
}
;
\node
(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]
{
3
}
;
\node
(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]
{
8
}
;
\node
(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]
{
1
}
;
\node
(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]
{
3
}
;
\node
(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]
{
2
}
;
\node
(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]
{
2
}
;
\node
(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]
{
1
}
;
\node
(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]
{
3
}
;
\node
(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]
{
3
}
;
\node
(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]
{
2
}
;
\node
(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]
{
0
}
;
\node
(num16)[num,below of = num10,yshift= -0.6cm,fill=blue!10]
{
4
}
;
\node
(num16)[num,below of = num10,yshift= -0.6cm,fill=blue!10]
{
4
}
;
\draw
[->,thick]
([xshift=0.4cm,yshift=-0.4cm]num8.east)--([xshift=1.5cm,yshift=-0.4cm]num8.east);
\draw
[->,thick]
([xshift=0.4cm,yshift=-0.4cm]num8.east)--([xshift=1.5cm,yshift=-0.4cm]num8.east);
\node
(num17)[num,right of = num8,xshift= 2.5cm,fill=red!10]
{
0
}
;
\node
(num17)[num,right of = num8,xshift= 2.5cm,fill=red!10]
{
3
}
;
\node
(num18)[num,right of = num17,xshift= 0.6cm,fill=green!10]
{
2
}
;
\node
(num18)[num,right of = num17,xshift= 0.6cm,fill=green!10]
{
6
}
;
\node
(num19)[num,below of = num17,yshift=-0.6cm,fill=yellow!10]
{
7
}
;
\node
(num19)[num,below of = num17,yshift=-0.6cm,fill=yellow!10]
{
2
}
;
\node
(num20)[num,below of = num18,yshift= -0.6cm,fill=blue!10]
{
3
}
;
\node
(num20)[num,below of = num18,yshift= -0.6cm,fill=blue!10]
{
2
}
;
\node
[right of = num2,xshift= -0.7cm]
{}
;
\node
[right of = num2,xshift= -0.7cm]
{}
;
...
...
Chapter11/Figures/figure-fairseq-0.tex
查看文件 @
fc60356e
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
\node
[draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.8em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (tgt
_
1) (i
_
0)(tgt
_
2)(i
_
5) ] (group1
_
2)
{}
;
\node
[draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.8em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (tgt
_
1) (i
_
0)(tgt
_
2)(i
_
5) ] (group1
_
2)
{}
;
\end{pgfonlayer}
\end{pgfonlayer}
\node
[anchor=east, word]
(l
_
0) at ([xshift=-2em,yshift=-0.5em]i
_
0.west)
{
\sffamily\bfnew
{
词嵌入
}}
;
\node
[anchor=east, word]
(l
_
0) at ([xshift=-2em,yshift=-0.5em]i
_
0.west)
{
\sffamily\bfnew
{
目标语
词嵌入
}}
;
\node
[anchor=south, word]
(l
_
1) at ([yshift=2em]l
_
0.north)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=south, word]
(l
_
1) at ([yshift=2em]l
_
0.north)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=south, word]
(l
_
2) at ([yshift=2.4em]l
_
1.north)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=south, word]
(l
_
2) at ([yshift=2.4em]l
_
1.north)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=south, word]
(l
_
3) at ([yshift=0.06em]l
_
2.north)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=south, word]
(l
_
3) at ([yshift=0.06em]l
_
2.north)
{
\sffamily\bfnew
{
线性单元
}}
;
...
@@ -144,7 +144,7 @@
...
@@ -144,7 +144,7 @@
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-4em,yshift=0.5em]r
_
0.west)
{
\sffamily\bfnew
{
词嵌入
}}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-4em,yshift=0.5em]r
_
0.west)
{
\sffamily\bfnew
{
源语
词嵌入
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-2em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-2em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
...
...
Chapter11/Figures/figure-fairseq-2.tex
查看文件 @
fc60356e
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
4.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
4.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
5.south)
{
school
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
5.south)
{
school
}
;
\node
[anchor=east, word]
(l
_
0) at ([xshift=-2em,yshift=-0.5em]i
_
0.west)
{
\sffamily\bfnew
{
词嵌入
}}
;
\node
[anchor=east, word]
(l
_
0) at ([xshift=-2em,yshift=-0.5em]i
_
0.west)
{
\sffamily\bfnew
{
目标语
词嵌入
}}
;
\node
[anchor=south, word]
(l
_
1) at ([yshift=2em]l
_
0.north)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=south, word]
(l
_
1) at ([yshift=2em]l
_
0.north)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=south, word]
(l
_
2) at ([yshift=2.4em]l
_
1.north)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=south, word]
(l
_
2) at ([yshift=2.4em]l
_
1.north)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=south, word]
(l
_
3) at ([yshift=0.06em]l
_
2.north)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=south, word]
(l
_
3) at ([yshift=0.06em]l
_
2.north)
{
\sffamily\bfnew
{
线性单元
}}
;
...
@@ -139,7 +139,7 @@
...
@@ -139,7 +139,7 @@
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-4em,yshift=0.5em]r
_
0.west)
{
\sffamily\bfnew
{
词嵌入
}}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-4em,yshift=0.5em]r
_
0.west)
{
\sffamily\bfnew
{
源语
词嵌入
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-2em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-2em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
...
...
Chapter11/Figures/figure-fairseq-3.tex
查看文件 @
fc60356e
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
4.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
4.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
5.south)
{
school
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
5.south)
{
school
}
;
\node
[anchor=east, word]
(l
_
0) at ([xshift=-2em,yshift=-0.5em]i
_
0.west)
{
\sffamily\bfnew
{
词嵌入
}}
;
\node
[anchor=east, word]
(l
_
0) at ([xshift=-2em,yshift=-0.5em]i
_
0.west)
{
\sffamily\bfnew
{
目标语
词嵌入
}}
;
\node
[anchor=south, word]
(l
_
1) at ([yshift=2em]l
_
0.north)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=south, word]
(l
_
1) at ([yshift=2em]l
_
0.north)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=south, word]
(l
_
2) at ([yshift=2.4em]l
_
1.north)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=south, word]
(l
_
2) at ([yshift=2.4em]l
_
1.north)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=south, word]
(l
_
3) at ([yshift=0.06em]l
_
2.north)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=south, word]
(l
_
3) at ([yshift=0.06em]l
_
2.north)
{
\sffamily\bfnew
{
线性单元
}}
;
...
@@ -140,7 +140,7 @@
...
@@ -140,7 +140,7 @@
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-4em,yshift=0.5em]r
_
0.west)
{
\sffamily\bfnew
{
词嵌入
}}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-4em,yshift=0.5em]r
_
0.west)
{
\sffamily\bfnew
{
源语
词嵌入
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-2em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-2em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
...
...
Chapter11/Figures/figure-image-convolution.tex
查看文件 @
fc60356e
...
@@ -25,9 +25,9 @@
...
@@ -25,9 +25,9 @@
\node
[data,inner sep=2pt,fill=cyan!40]
at (14.4em,2.4em)
{
19
}
;
\node
[data,inner sep=2pt,fill=cyan!40]
at (14.4em,2.4em)
{
19
}
;
\node
[data,inner sep=2pt]
at (16em,2.4em)
{
25
}
;
\node
[data,inner sep=2pt]
at (16em,2.4em)
{
25
}
;
\node
[font=\footnotesize]
(in) at (1.6em,
4.8em)
{
输入
}
;
\node
[font=\footnotesize]
(in) at (1.6em,
-1.8em)
{
输入:
$
3
\times
3
$
}
;
\node
[font=\footnotesize]
at (8.8em,
4.8em)
{
卷积核
}
;
\node
[font=\footnotesize]
at (8.8em,
-1.8em)
{
卷积核:
$
2
\times
2
$
}
;
\node
[font=\footnotesize]
(out) at (15.2em,
4.8em)
{
输出
}
;
\node
[font=\footnotesize]
(out) at (15.2em,
-1.8em)
{
输出:
$
2
\times
2
$
}
;
%\node[font=\footnotesize,dashed,draw=cyan,very thick,fill=cyan!5,align=center] at ([yshift=-0.3cm,xshift=1.8cm]out.east) {*\ \ :表示\\卷积计算};
%\node[font=\footnotesize,dashed,draw=cyan,very thick,fill=cyan!5,align=center] at ([yshift=-0.3cm,xshift=1.8cm]out.east) {*\ \ :表示\\卷积计算};
%\node[] at ([yshift=-0.3cm,xshift=-2.3cm]in.east) {\ \ \ \ \ };
%\node[] at ([yshift=-0.3cm,xshift=-2.3cm]in.east) {\ \ \ \ \ };
...
...
Chapter11/Figures/figure-max-pooling.tex
查看文件 @
fc60356e
...
@@ -4,16 +4,19 @@
...
@@ -4,16 +4,19 @@
\begin{tikzpicture}
[node distance = 0cm]
\begin{tikzpicture}
[node distance = 0cm]
\node
(num1)[num,fill=red!10]
{
1
}
;
\node
(num1)[num,fill=red!10]
{
1
}
;
\node
(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]
{
5
}
;
\node
(num2)[num,below of = num1,yshift= -0.6cm,fill=red!10]
{
5
}
;
\node
(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]
{
1
}
;
\node
(num3)[num,right of = num1,xshift= 0.6cm,fill=red!10]
{
0
}
;
\node
(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]
{
6
}
;
\node
(num4)[num,below of = num3,yshift= -0.6cm,fill=red!10]
{
6
}
;
\node
(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]
{
2
}
;
\node
(num5)[num,right of = num3,xshift= 0.6cm,fill=green!10]
{
4
}
;
\node
(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]
{
7
}
;
\node
(num6)[num,below of = num5,yshift= -0.6cm,fill=green!10]
{
7
}
;
\node
(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]
{
4
}
;
\node
(num7)[num,right of = num5,xshift= 0.6cm,fill=green!10]
{
5
}
;
\node
(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]
{
8
}
;
\node
(num8)[num,below of = num7,yshift= -0.6cm,fill=green!10]
{
8
}
;
\node
(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]
{
3
}
;
\node
(num9)[num,below of = num2,yshift= -0.6cm,fill=yellow!10]
{
3
}
;
\node
(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]
{
1
}
;
\node
(num10)[num,below of = num9,yshift= -0.6cm,fill=yellow!10]
{
1
}
;
\node
(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]
{
2
}
;
\node
(num11)[num,right of = num9,xshift= 0.6cm,fill=yellow!10]
{
2
}
;
\node
(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]
{
2
}
;
\node
(num12)[num,below of = num11,yshift= -0.6cm,fill=yellow!10]
{
2
}
;
\node
(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]
{
1
}
;
\node
(num13)[num,right of = num11,xshift= 0.6cm,fill=blue!10]
{
1
}
;
\node
(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]
{
3
}
;
\node
(num14)[num,below of = num13,yshift= -0.6cm,fill=blue!10]
{
3
}
;
\node
(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]
{
0
}
;
\node
(num10)[num,right of = num13,xshift= 0.6cm,fill=blue!10]
{
0
}
;
...
...
Chapter11/Figures/figure-use-cnn-in-sentence-classification.tex
查看文件 @
fc60356e
...
@@ -20,38 +20,42 @@
...
@@ -20,38 +20,42 @@
\draw
[red!60,line width=2pt]
(0cm,0cm+7*
\bcc
) rectangle (0cm+6*
\bcc
,0cm+9*
\bcc
);
\draw
[red!60,line width=2pt]
(0cm,0cm+7*
\bcc
) rectangle (0cm+6*
\bcc
,0cm+9*
\bcc
);
% 特征图
% 特征图
\draw
[fill=blue!8,xshift=5.0cm,yshift=1.3cm,line width=0.6pt]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+6*
\bcc
);
\draw
[fill=blue!8,xshift=5.0cm,yshift=1.3cm,line width=0.6pt]
(0cm,0cm
-1*
\bcc
) rectangle (0cm+1*
\bcc
,0cm+6*
\bcc
);
\draw
[step=\bcc,gray,xshift=5.0cm,yshift=1.3cm]
(0cm,0cm) grid (0cm+1*
\bcc
,0cm+6*
\bcc
);
\draw
[step=\bcc,gray,xshift=5.0cm,yshift=1.3cm]
(0cm,0cm
-1*
\bcc
) grid (0cm+1*
\bcc
,0cm+6*
\bcc
);
\draw
[ugreen!60,line width=2pt,xshift=5.0cm,yshift=1.3cm]
(0cm,0cm+2*
\bcc
) rectangle (0cm+1*
\bcc
,0cm+3*
\bcc
);
\draw
[ugreen!60,line width=2pt,xshift=5.0cm,yshift=1.3cm]
(0cm,0cm+2*
\bcc
) rectangle (0cm+1*
\bcc
,0cm+3*
\bcc
);
\draw
[gray,fill=blue!8,line width=0.6pt](8cm,2.6cm) -- (8.4cm, 2.6cm) -- (9cm,1cm) -- (8.6cm, 1cm) -- (8cm,2.6cm);
%最大池化
\draw
[gray](8.15cm,2.2cm) -- (8.55cm,2.2cm);
\draw
[gray,fill=blue!8,line width=0.6pt](8cm,2.2cm) -- (8.4cm, 2.2cm) -- (8.7cm,1.4cm) -- (8.3cm, 1.4cm) -- (8cm,2.2cm);
\draw
[gray](8.3cm,1.8cm) -- (8.7cm,1.8cm);
\draw
[gray](8.15cm,1.8cm) -- (8.55cm,1.8cm);
\draw
[gray](8.45cm,1.4cm) -- (8.85cm,1.4cm);
%\draw [gray](8.3cm,1.8cm) -- (8.7cm,1.8cm);
%\draw [gray](8.45cm,1.4cm) -- (8.85cm,1.4cm);
\draw
[gray,fill=blue!8,line width=0.6pt](11cm,2.2cm) -- (11.4cm, 2.2cm) -- (11.7cm,1.4cm) -- (11.3cm, 1.4cm) -- (11cm,2.2cm);
%全连接层
\draw
[gray](11.15cm,1.8cm) -- (11.55cm,1.8cm);
\draw
[gray,fill=blue!8,line width=0.6pt](11cm,2.2cm) -- (11.4cm, 2.2cm) -- (11.7cm,1.8cm) -- (11.3cm, 1.8cm) -- (11cm,2.2cm);
%\draw [gray](11.15cm,1.8cm) -- (11.55cm,1.8cm);
\draw
[ugreen!60,line]
([xshift=5.0cm,yshift=1.3cm]0cm+1*
\bcc
,0cm+6*
\bcc
) -- (8cm,2.6cm);
%最大池化
\draw
[ugreen!60,line]
([xshift=5.0cm,yshift=1.3cm]0cm+1*
\bcc
,0cm) -- (8.15cm,2.2cm);
\draw
[ugreen!60,line]
([xshift=5.0cm,yshift=1.3cm]0cm+1*
\bcc
,0cm+6*
\bcc
) -- (8cm,2.2cm);
\draw
[ugreen!60,line]
([xshift=5.0cm,yshift=1.3cm]0cm+1*
\bcc
,0cm-1*
\bcc
) -- (8.15cm,1.8cm);
\draw
[fill=blue!8,xshift=5.2cm,yshift=1.0cm,line width=0.6pt]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+6*
\bcc
);
%特征图
\draw
[step=\bcc,gray,xshift=5.2cm,yshift=1.0cm]
(0cm,0cm) grid (0cm+1*
\bcc
,0cm+6*
\bcc
);
%\draw[fill=blue!8,xshift=5.2cm,yshift=1.0cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+6*\bcc);
%\draw[step=\bcc,gray,xshift=5.2cm,yshift=1.0cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+6*\bcc);
\draw
[fill=blue!8,xshift=5.4cm,yshift=0.3cm,line width=0.6pt]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+7*
\bcc
);
%
\draw[fill=blue!8,xshift=5.4cm,yshift=0.3cm,line width=0.6pt] (0cm,0cm) rectangle (0cm+1*\bcc,0cm+7*\bcc);
\draw
[step=\bcc,gray,xshift=5.4cm,yshift=0.3cm]
(0cm,0cm) grid (0cm+1*
\bcc
,0cm+7*
\bcc
);
%
\draw[step=\bcc,gray,xshift=5.4cm,yshift=0.3cm] (0cm,0cm) grid (0cm+1*\bcc,0cm+7*\bcc);
\draw
[fill=blue!8,xshift=5.6cm,yshift=0cm,line width=0.6pt]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+
7
*
\bcc
);
\draw
[fill=blue!8,xshift=5.6cm,yshift=0cm,line width=0.6pt]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+
8
*
\bcc
);
\draw
[step=\bcc,gray,xshift=5.6cm,yshift=0cm]
(0cm,0cm) grid (0cm+1*
\bcc
,0cm+
7
*
\bcc
);
\draw
[step=\bcc,gray,xshift=5.6cm,yshift=0cm]
(0cm,0cm) grid (0cm+1*
\bcc
,0cm+
8
*
\bcc
);
\draw
[red!60,line width=2pt,xshift=5.6cm,yshift=0cm]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+1*
\bcc
);
\draw
[red!60,line width=2pt,xshift=5.6cm,yshift=0cm]
(0cm,0cm) rectangle (0cm+1*
\bcc
,0cm+1*
\bcc
);
\draw
[red!60,line width=2pt,xshift=5.6cm,yshift=0cm]
(0cm,0cm+2*
\bcc
) rectangle (0cm+1*
\bcc
,0cm+3*
\bcc
);
\draw
[red!60,line width=2pt,xshift=5.6cm,yshift=0cm]
(0cm,0cm+7*
\bcc
) rectangle (0cm+1*
\bcc
,0cm+8*
\bcc
);
\draw
[red!60,line width=2pt,xshift=5.6cm,yshift=0cm]
(0cm,0cm+6*
\bcc
) rectangle (0cm+1*
\bcc
,0cm+7*
\bcc
);
\draw
[line]
(8.4cm, 2.6cm) -- (11cm,2.2cm);
% 全连接线
\draw
[line]
(9cm,1cm) -- (11.3cm, 1.4cm);
\draw
[line]
(8.4cm, 2.2cm) -- (11.2cm,2.2cm);
\draw
[line]
(8.7cm,1.4cm) -- (11.3cm, 1.8cm);
\draw
[red!60,line]
([xshift=5.6cm,yshift=0cm]0cm+1*
\bcc
,0cm+7*
\bcc
) -- (8.
45cm,1.4
cm);
\draw
[red!60,line]
([xshift=5.6cm,yshift=0cm]0cm+1*
\bcc
,0cm+7*
\bcc
) -- (8.
15cm,1.8
cm);
\draw
[red!60,line]
([xshift=5.6cm,yshift=0cm]0cm+1*
\bcc
,0cm) -- (8.
6cm, 1
cm);
\draw
[red!60,line]
([xshift=5.6cm,yshift=0cm]0cm+1*
\bcc
,0cm) -- (8.
25cm, 1.4
cm);
\draw
[red!60,line]
(0cm+6*
\bcc
,0cm+9*
\bcc
) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+7*
\bcc
);
\draw
[red!60,line]
(0cm+6*
\bcc
,0cm+9*
\bcc
) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+7*
\bcc
);
\draw
[red!60,line]
(0cm+6*
\bcc
,0cm+7*
\bcc
) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+6*
\bcc
);
\draw
[red!60,line]
(0cm+6*
\bcc
,0cm+7*
\bcc
) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+6*
\bcc
);
...
@@ -59,8 +63,8 @@
...
@@ -59,8 +63,8 @@
\draw
[red!60,line]
(0cm+6*
\bcc
,0cm) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm);
\draw
[red!60,line]
(0cm+6*
\bcc
,0cm) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm);
\draw
[ugreen!60,line]
(0cm+6*
\bcc
,0cm+6*
\bcc
) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+3*
\bcc
);
\draw
[ugreen!60,line]
(0cm+6*
\bcc
,0cm+6*
\bcc
) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+3*
\bcc
);
\draw
[ugreen!60,line]
(0cm+6*
\bcc
,0cm+3*
\bcc
) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+2*
\bcc
);
\draw
[ugreen!60,line]
(0cm+6*
\bcc
,0cm+3*
\bcc
) -- ([xshift=5.0cm,yshift=1.3cm]0cm,0cm+2*
\bcc
);
\draw
[red!60,line]
([xshift=0.3cm,yshift=0.5cm]0cm+6*
\bcc
,0cm+4*
\bcc
) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+3*
\bcc
);
%
\draw[red!60,line] ([xshift=0.3cm,yshift=0.5cm]0cm+6*\bcc,0cm+4*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+3*\bcc);
\draw
[red!60,line]
([xshift=0.3cm,yshift=0.5cm]0cm+6*
\bcc
,0cm+2*
\bcc
) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+2*
\bcc
);
%
\draw[red!60,line] ([xshift=0.3cm,yshift=0.5cm]0cm+6*\bcc,0cm+2*\bcc) -- ([xshift=5.6cm,yshift=0cm]0cm,0cm+2*\bcc);
\node
[word]
(w1) at (-0.5cm, 3.4cm)
{
wait
}
;
\node
[word]
(w1) at (-0.5cm, 3.4cm)
{
wait
}
;
\node
[word]
(w2) at ([yshift=-
\bcc
]w1)
{
for
}
;
\node
[word]
(w2) at ([yshift=-
\bcc
]w1)
{
for
}
;
...
@@ -76,7 +80,7 @@
...
@@ -76,7 +80,7 @@
\node
[draw,rectangle callout,callout relative pointer={(0.1,-0.5)}]
at (5cm,4.6cm)
{
\textrm
{
特征图
}}
;
\node
[draw,rectangle callout,callout relative pointer={(0.1,-0.5)}]
at (5cm,4.6cm)
{
\textrm
{
特征图
}}
;
\draw
[thick] (0cm, -0.3cm) -- (0cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
维度大小为
$
m
\times
K
$
\\
的静态与非静态通道
\\
的句子表示
}
(2.4cm,-0.5cm) -- (2.4cm, -0.3cm);
\draw
[thick] (0cm, -0.3cm) -- (0cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
维度大小为
$
m
\times
O
$
\\
的句子表示
}
(2.4cm,-0.5cm) -- (2.4cm, -0.3cm);
\draw
[thick] (3.6cm, -0.3cm) -- (3.6cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
具有多个不同大小
\\
的卷积核和特征图
\\
的卷积层
}
(6cm,-0.5cm) -- (6cm, -0.3cm);
\draw
[thick] (3.6cm, -0.3cm) -- (3.6cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
具有多个不同大小
\\
的卷积核和特征图
\\
的卷积层
}
(6cm,-0.5cm) -- (6cm, -0.3cm);
\draw
[thick] (7.2cm, -0.3cm) -- (7.2cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
最大池化
}
(9cm,-0.5cm) -- (9cm, -0.3cm);
\draw
[thick] (7.2cm, -0.3cm) -- (7.2cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
最大池化
}
(9cm,-0.5cm) -- (9cm, -0.3cm);
\draw
[thick] (10cm, -0.3cm) -- (10cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
带有Dropout
\\
和Softmax输出
\\
的全连接层
}
(11.7cm,-0.5cm) -- (11.7cm, -0.3cm);
\draw
[thick] (10cm, -0.3cm) -- (10cm, -0.5cm) -- node[font=
\tiny
, align=center,yshift=-0.5cm]
{
带有Dropout
\\
和Softmax输出
\\
的全连接层
}
(11.7cm,-0.5cm) -- (11.7cm, -0.3cm);
...
...
Chapter11/chapter11.tex
查看文件 @
fc60356e
差异被折叠。
点击展开。
Chapter12/chapter12.tex
查看文件 @
fc60356e
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
%----------------------------------------------
%----------------------------------------------
\begin{table}
[htp]
\begin{table}
[htp]
\centering
\centering
\caption
{
不同翻译模型性能对比
\upcite
{
NIPS2017
_
7181
}}
\caption
{
不同翻译模型性能对比
\upcite
{
vaswani2017attention
}}
\label
{
tab:12-12
}
\label
{
tab:12-12
}
\begin{tabular}
{
l l l l
}
\begin{tabular}
{
l l l l
}
\multicolumn
{
1
}{
l|
}{
\multirow
{
2
}{
*
}{
系统
}}
&
\multicolumn
{
2
}{
c
}{
BLEU[
\%
]
}
&
\multirow
{
2
}{
*
}{
\parbox
{
6em
}{
模型训练代价 (FLOPs)
}}
\\
\multicolumn
{
1
}{
l|
}{
\multirow
{
2
}{
*
}{
系统
}}
&
\multicolumn
{
2
}{
c
}{
BLEU[
\%
]
}
&
\multirow
{
2
}{
*
}{
\parbox
{
6em
}{
模型训练代价 (FLOPs)
}}
\\
...
@@ -328,7 +328,7 @@
...
@@ -328,7 +328,7 @@
\vspace
{
0.5em
}
\vspace
{
0.5em
}
\item
其次,对每个头分别执行点乘注意力操作,并得到每个头的注意力操作的输出
$
\mathbi
{
head
}_
i
$
;
\item
其次,对每个头分别执行点乘注意力操作,并得到每个头的注意力操作的输出
$
\mathbi
{
head
}_
i
$
;
\vspace
{
0.5em
}
\vspace
{
0.5em
}
\item
最后,将
$
h
$
个头的注意力输出在最后一维
$
d
_
v
$
进行拼接(Concat)重新得到维度为
$
h
\times
d
_
v
$
的输出,并通过对其左乘一个权重矩阵
$
\mathbi
{
W
}^{
\,
o
}$
进行线性变换,从而对多头计算得到的信息进行融合,且将多头注意力输出的维度映射为模型的隐层大小(即
$
d
_{
model
}$
),这里参数矩阵
$
\mathbi
{
W
}^{
\,
o
}
\in
\mathbb
{
R
}^{
h
\times
d
_
v
\times
d
_{
model
}}$
。
\item
最后,将
$
h
$
个头的注意力输出在最后一维
$
d
_
v
$
进行拼接(Concat)重新得到维度为
$
h
\times
d
_
v
$
的输出,并通过对其左乘一个权重矩阵
$
\mathbi
{
W
}^{
\,
o
}$
进行线性变换,从而对多头计算得到的信息进行融合,且将多头注意力输出的维度映射为模型的隐层大小(即
$
d
_{
model
}$
),这里参数矩阵
$
\mathbi
{
W
}^{
\,
o
}
\in
\mathbb
{
R
}^{
h d
_
v
\times
d
_{
model
}}$
。
\vspace
{
0.5em
}
\vspace
{
0.5em
}
\end{itemize}
\end{itemize}
...
@@ -527,7 +527,7 @@ lrate = d_{\textrm{model}}^{-0.5} \cdot \textrm{min} (\textrm{step}^{-0.5} , \te
...
@@ -527,7 +527,7 @@ lrate = d_{\textrm{model}}^{-0.5} \cdot \textrm{min} (\textrm{step}^{-0.5} , \te
\vspace
{
0.5em
}
\vspace
{
0.5em
}
\end{itemize}
\end{itemize}
\parinterval
不同的Transformer可以适应不同的任务,常见的Transformer模型有Transformer Base、Transformer Big和Transformer Deep
\upcite
{
NIPS2017
_
7181
,WangLearning
}
,具体设置如下:
\parinterval
不同的Transformer可以适应不同的任务,常见的Transformer模型有Transformer Base、Transformer Big和Transformer Deep
\upcite
{
vaswani2017attention
,WangLearning
}
,具体设置如下:
\begin{itemize}
\begin{itemize}
\vspace
{
0.5em
}
\vspace
{
0.5em
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论