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
08a7bd70
Commit
08a7bd70
authored
Sep 09, 2020
by
zengxin
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'zengxin' 到 'caorunzhe'
Zengxin 查看合并请求
!167
parents
198c7441
baff62b2
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
147 行增加
和
369 行删除
+147
-369
Chapter10/Figures/figure-3-base-problom-of-p.tex
+6
-6
Chapter10/Figures/figure-a-simple-example-for-tl.tex
+2
-2
Chapter10/Figures/figure-calculation-process-of-context-vector-c.tex
+9
-9
Chapter10/Figures/figure-encoder-decoder-process.tex
+3
-3
Chapter10/Figures/figure-encoder-decoder-with-attention.tex
+3
-3
Chapter10/Figures/figure-example-of-context-vector-calculation-process.tex
+6
-5
Chapter10/Figures/figure-gru01.tex
+2
-2
Chapter10/Figures/figure-gru02.tex
+2
-2
Chapter10/Figures/figure-gru03.tex
+4
-4
Chapter10/Figures/figure-lstm01.tex
+3
-3
Chapter10/Figures/figure-lstm02.tex
+3
-3
Chapter10/Figures/figure-lstm03.tex
+4
-4
Chapter10/Figures/figure-lstm04.tex
+6
-6
Chapter10/Figures/figure-output-layer-structur.tex
+1
-1
Chapter10/Figures/figure-query-model-corresponding-to-attention-mechanism.tex
+9
-9
Chapter10/Figures/figure-the-whole-of-lstm.tex
+10
-10
Chapter10/Figures/figure-word-embedding-structure.tex
+4
-4
Chapter10/chapter10.tex
+70
-293
没有找到文件。
Chapter10/Figures/figure-3-base-problom-of-p.tex
查看文件 @
08a7bd70
...
...
@@ -15,9 +15,9 @@
\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
()
$}}
;
\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
[]
(enclabel1) at (enc1)
{
\tiny
{$
\
textbf
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel2) at (enc2)
{
\tiny
{$
\
textbf
{
h
}_{
m
-
1
}$}}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel3) at (enc3)
{
\tiny
{$
\
textbf
{
h
}_{
m
}$}}
;
\node
[]
(enclabel1) at (enc1)
{
\tiny
{$
\
vectorn
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel2) at (enc2)
{
\tiny
{$
\
vectorn
{
h
}_{
m
-
1
}$}}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel3) at (enc3)
{
\tiny
{$
\
vectorn
{
h
}_{
m
}$}}
;
\node
[wordnode,left=0.4\base of enc1]
(init1)
{$
\cdots
$}
;
\node
[wordnode,left=0.4\base of eemb1]
(init2)
{$
\cdots
$}
;
...
...
@@ -29,7 +29,7 @@
\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
()
$}}
;
\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
{$
\
textbf
{
s
}_
\x
$}}}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.3
\base
]demb
\x
.north)
{{
\tiny
{$
\
vectorn
{
s
}_
\x
$}}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south]
(softmax
\x
) at ([yshift=0.3
\base
]dec
\x
.north)
{
\tiny
{
Softmax
}}
;
\node
[wordnode,right=0.4\base of demb3]
(end1)
{$
\cdots
$}
;
...
...
@@ -73,7 +73,7 @@
\draw
[-latex']
(enc3.north) .. controls +(north:0.3
\base
) and +(east:
\base
) .. (bridge) .. controls +(west:2.7
\base
) and +(west:0.3
\base
) .. (dec1.west);
{
\node
[anchor=east] (line1) at ([xshift=-3em,yshift=0.5em]softmax1.west)
{
\scriptsize
{
基于RNN的隐层状态
$
\
textbf
{
s
}_
i
$}}
;
\node
[anchor=east] (line1) at ([xshift=-3em,yshift=0.5em]softmax1.west)
{
\scriptsize
{
基于RNN的隐层状态
$
\
vectorn
{
s
}_
i
$}}
;
\node
[anchor=north west] (line2) at ([yshift=0.3em]line1.south west)
{
\scriptsize
{
预测目标词的概率
}}
;
\node
[anchor=north west] (line3) at ([yshift=0.3em]line2.south west)
{
\scriptsize
{
通常,用Softmax函数
}}
;
\node
[anchor=north west] (line4) at ([yshift=0.3em]line3.south west)
{
\scriptsize
{
实现
$
\textrm
{
P
}
(
y
_
i|...
)
$}}
;
...
...
@@ -90,7 +90,7 @@
\node
[anchor=west] (line21) at ([xshift=1.3em,yshift=1.5em]enc3.east)
{
\scriptsize
{
源语编码器最后一个
}}
;
\node
[anchor=north west] (line22) at ([yshift=0.3em]line21.south west)
{
\scriptsize
{
循环单元的输出被
}}
;
\node
[anchor=north west] (line23) at ([yshift=0.3em]line22.south west)
{
\scriptsize
{
看作是句子的表示,
}}
;
\node
[anchor=north west] (line24) at ([yshift=0.3em]line23.south west)
{
\scriptsize
{
记为
$
\
textbf
{
C
}$}}
;
\node
[anchor=north west] (line24) at ([yshift=0.3em]line23.south west)
{
\scriptsize
{
记为
$
\
vectorn
{
C
}$}}
;
}
\begin{pgfonlayer}
{
background
}
...
...
Chapter10/Figures/figure-a-simple-example-for-tl.tex
查看文件 @
08a7bd70
...
...
@@ -9,14 +9,14 @@
\node
[pos=0.4,left,xshift=-36em,yshift=7em,font=
\small
] (original0)
{
\quad
源语(中文)输入:
}
;
\node
[pos=0.4,left,xshift=-22em,yshift=7em,font=
\small
] (original1)
{
\begin{tabular}
[t]
{
l
}
\parbox
{
14em
}{
``我''、``很''、``好''、``<eos>''
}
\parbox
{
14em
}{
“我”、“很”、“好”、“<eos>”
}
\end{tabular}
}
;
%译文1--------------mt1
\node
[font=\small]
(mt1) at ([xshift=0em,yshift=-1em]original0.south)
{
目标语(英文)输出:
}
;
\node
[font=\small]
(ts1) at ([xshift=0em,yshift=-1em]original1.south)
{
\begin{tabular}
[t]
{
l
}
\parbox
{
14em
}{
``I''、``am''、``fine''、``<eos>''
}
\parbox
{
14em
}{
“I”、“am”、“fine”、“<eos>”
}
\end{tabular}
}
;
...
...
Chapter10/Figures/figure-calculation-process-of-context-vector-c.tex
查看文件 @
08a7bd70
...
...
@@ -8,26 +8,26 @@
\begin{scope}
\node
[anchor=west,draw,fill=red!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (h1) at (0,0)
{
\scriptsize
{$
\
textbf
{
h
}_
1
$}}
;
\node
[anchor=west,draw,fill=red!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (h2) at ([xshift=1em]h1.east)
{
\scriptsize
{$
\
textbf
{
h
}_
2
$}}
;
\node
[anchor=west,draw,fill=red!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (h1) at (0,0)
{
\scriptsize
{$
\
vectorn
{
h
}_
1
$}}
;
\node
[anchor=west,draw,fill=red!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (h2) at ([xshift=1em]h1.east)
{
\scriptsize
{$
\
vectorn
{
h
}_
2
$}}
;
\node
[anchor=west,inner sep=0pt,minimum width=3em] (h3) at ([xshift=0.5em]h2.east)
{
\scriptsize
{
...
}}
;
\node
[anchor=west,draw,fill=red!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (h4) at ([xshift=0.5em]h3.east)
{
\scriptsize
{$
\
textbf
{
h
}_
m
$}}
;
\node
[anchor=west,draw,fill=red!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (h4) at ([xshift=0.5em]h3.east)
{
\scriptsize
{$
\
vectorn
{
h
}_
m
$}}
;
\node
[anchor=south,circle,minimum size=1.0em,draw,ublue,thick] (sum) at ([yshift=2em]h2.north east)
{}
;
\draw
[thick,-,ublue] (sum.north) -- (sum.south);
\draw
[thick,-,ublue] (sum.west) -- (sum.east);
\node
[anchor=south,draw,fill=green!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (th1) at ([yshift=2em,xshift=-1em]sum.north west)
{
\scriptsize
{$
\
textbf
{
s
}_{
j
-
1
}$}}
;
\node
[anchor=west,draw,fill=green!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (th2) at ([xshift=2em]th1.east)
{
\scriptsize
{$
\
textbf
{
s
}_{
j
}$}}
;
\node
[anchor=south,draw,fill=green!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (th1) at ([yshift=2em,xshift=-1em]sum.north west)
{
\scriptsize
{$
\
vectorn
{
s
}_{
j
-
1
}$}}
;
\node
[anchor=west,draw,fill=green!20!white,inner sep=3pt,minimum width=2em,minimum height=1.2em] (th2) at ([xshift=2em]th1.east)
{
\scriptsize
{$
\
vectorn
{
s
}_{
j
}$}}
;
\draw
[->] (h1.north) .. controls +(north:0.8) and +(west:1) .. (sum.190) node [pos=0.
3
,left]
{
\scriptsize
{$
\alpha
_{
1
,j
}$}}
;
\draw
[->] (h1.north) .. controls +(north:0.8) and +(west:1) .. (sum.190) node [pos=0.
2
,left]
{
\scriptsize
{$
\alpha
_{
1
,j
}$}}
;
\draw
[->] (h2.north) .. controls +(north:0.6) and +(220:0.2) .. (sum.220) node [pos=0.2,right]
{
\scriptsize
{$
\alpha
_{
2
,j
}$}}
;
\draw
[->] (h4.north) .. controls +(north:0.8) and +(east:1) .. (sum.-10) node [pos=0.1,left] (alphan)
{
\scriptsize
{$
\alpha
_{
m,j
}$}}
;
\draw
[->] ([xshift=-1.5em]th1.west) -- ([xshift=-0.1em]th1.west);
\draw
[->] ([xshift=0.1em]th1.east) -- ([xshift=-0.1em]th2.west);
\draw
[->] ([xshift=0.1em]th2.east) -- ([xshift=1.5em]th2.east);
\draw
[->] (sum.north) .. controls +(north:0.8) and +(west:0.2) .. ([yshift=-0.4em,xshift=-0.1em]th2.west) node [pos=0.2,right] (ci)
{
\scriptsize
{$
\
textbf
{
C
}_{
j
}$}}
;
\draw
[->] (sum.north) .. controls +(north:0.8) and +(west:0.2) .. ([yshift=-0.4em,xshift=-0.1em]th2.west) node [pos=0.2,right] (ci)
{
\scriptsize
{$
\
vectorn
{
C
}_{
j
}$}}
;
\node
[anchor=south,inner sep=1pt] (output) at ([yshift=0.8em]th2.north)
{
\scriptsize
{
输出层
}}
;
\draw
[->] ([yshift=0.1em]th2.north) -- ([yshift=-0.1em]output.south);
...
...
@@ -39,11 +39,11 @@
\node
[anchor=north] (enc42) at ([yshift=0.5em]enc4.south)
{
\scriptsize
{
(位置
$
4
$
)
}}
;
{
\node
[anchor=west] (math1) at ([xshift=5em,yshift=1em]th2.east)
{$
\
textbf
{
C
}_
j
=
\sum
_{
i
}
\alpha
_{
i,j
}
\textbf
{
h
}_
i
\ \
$}
;
\node
[anchor=west] (math1) at ([xshift=5em,yshift=1em]th2.east)
{$
\
vectorn
{
C
}_
j
=
\sum
_{
i
}
\alpha
_{
i,j
}
\vectorn
{
h
}_
i
\ \
$}
;
}
{
\node
[anchor=north west] (math2) at ([yshift=-2em]math1.south west)
{$
\alpha
_{
i,j
}
=
\frac
{
\exp
(
\beta
_{
i,j
}
)
}{
\sum
_{
i'
}
\exp
(
\beta
_{
i',j
}
)
}$}
;
\node
[anchor=north west] (math3) at ([yshift=-0em]math2.south west)
{$
\beta
_{
i,j
}
=
a
(
\
textbf
{
s
}_{
j
-
1
}
,
\textbf
{
h
}_
i
)
$}
;
\node
[anchor=north west] (math3) at ([yshift=-0em]math2.south west)
{$
\beta
_{
i,j
}
=
a
(
\
vectorn
{
s
}_{
j
-
1
}
,
\vectorn
{
h
}_
i
)
$}
;
}
\begin{pgfonlayer}
{
background
}
...
...
Chapter10/Figures/figure-encoder-decoder-process.tex
查看文件 @
08a7bd70
...
...
@@ -2,9 +2,9 @@
\begin{scope}
\small
{
\node
[anchor=south west,minimum width=15em] (source) at (0,0)
{
\textbf
{
source
}
: 我
\ \ \ \
对
\ \ \ \
你
\ \ \ \
感到
\ \ \ \
满意
}
;
\node
[anchor=south west,minimum width=15em] (source) at (0,0)
{
\textbf
{
源语
}
: 我
\ \ \ \
对
\ \ \ \
你
\ \ \ \
感到
\ \ \ \
满意
}
;
{
\node
[anchor=south west,minimum width=15em] (target) at ([yshift=12em]source.north west)
{
\textbf
{
target
}
: I
\ \
am
\ \ \
satisfied
\ \ \
with
\ \ \
you
}
;
\node
[anchor=south west,minimum width=15em] (target) at ([yshift=12em]source.north west)
{
\textbf
{
目标语
}
: I
\ \
am
\ \ \
satisfied
\ \ \
with
\ \ \
you
}
;
}
{
\node
[anchor=center,minimum width=9.6em,minimum height=1.8em,draw,rounded corners=0.3em] (hidden) at ([yshift=6em]source.north)
{}
;
...
...
@@ -24,7 +24,7 @@
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em] (cell08) at (cell06.east)
{
\small
{
\hspace
{
0.6em
}
\begin{tabular}
{
l
}
源语
言句子的``表示''
源语
句子的“表示”
\end{tabular}
}
}
;
...
...
Chapter10/Figures/figure-encoder-decoder-with-attention.tex
查看文件 @
08a7bd70
...
...
@@ -80,9 +80,9 @@
\draw
[<-]
([yshift=0.1em,xshift=1em]t6.north) -- ([yshift=1.2em,xshift=1em]t6.north);
\draw
[->] ([yshift=3em]s6.north) -- ([yshift=4em]s6.north) -- ([yshift=4em]t1.north) node [pos=0.5,fill=green!30,inner sep=2pt] (c1)
{
\scriptsize
{
表示
$
\
textbf
{
C
}_
1
$}}
-- ([yshift=3em]t1.north) ;
\draw
[->] ([yshift=3em]s5.north) -- ([yshift=5.3em]s5.north) -- ([yshift=5.3em]t2.north) node [pos=0.5,fill=green!30,inner sep=2pt] (c2)
{
\scriptsize
{
表示
$
\
textbf
{
C
}_
2
$}}
-- ([yshift=3em]t2.north) ;
\draw
[->] ([yshift=3.5em]s3.north) -- ([yshift=6.6em]s3.north) -- ([yshift=6.6em]t4.north) node [pos=0.5,fill=green!30,inner sep=2pt] (c3)
{
\scriptsize
{
表示
$
\
textbf
{
C
}_
i
$}}
-- ([yshift=3.5em]t4.north) ;
\draw
[->] ([yshift=3em]s6.north) -- ([yshift=4em]s6.north) -- ([yshift=4em]t1.north) node [pos=0.5,fill=green!30,inner sep=2pt] (c1)
{
\scriptsize
{
表示
$
\
vectorn
{
C
}_
1
$}}
-- ([yshift=3em]t1.north) ;
\draw
[->] ([yshift=3em]s5.north) -- ([yshift=5.3em]s5.north) -- ([yshift=5.3em]t2.north) node [pos=0.5,fill=green!30,inner sep=2pt] (c2)
{
\scriptsize
{
表示
$
\
vectorn
{
C
}_
2
$}}
-- ([yshift=3em]t2.north) ;
\draw
[->] ([yshift=3.5em]s3.north) -- ([yshift=6.6em]s3.north) -- ([yshift=6.6em]t4.north) node [pos=0.5,fill=green!30,inner sep=2pt] (c3)
{
\scriptsize
{
表示
$
\
vectorn
{
C
}_
i
$}}
-- ([yshift=3.5em]t4.north) ;
\node
[anchor=north] (smore) at ([yshift=3.5em]s3.north)
{
...
}
;
\node
[anchor=north] (tmore) at ([yshift=3.5em]t4.north)
{
...
}
;
...
...
Chapter10/Figures/figure-example-of-context-vector-calculation-process.tex
查看文件 @
08a7bd70
...
...
@@ -104,9 +104,9 @@
%\visible<3->
{
% coverage score formula node
\node
[anchor=north west] (formula) at ([xshift=-0.3
\hnode
,yshift=-1.5
\hnode
]attn11.south)
{
\small
{
不同
$
\
textbf
{
C
}_
j
$
所对应的源语言词的权重是不同的
}}
;
\node
[anchor=north west] (example) at (formula.south west)
{
\footnotesize
{$
\
textbf
{
C
}_
2
=
0
.
4
\times
\textbf
{
h
}
(
\textrm
{
``你''
}
)
+
0
.
4
\times
\textbf
{
h
}
(
\textrm
{
``什么''
}
)
+
$}}
;
\node
[anchor=north west] (example2) at ([yshift=0.4em]example.south west)
{
\footnotesize
{$
\ \ \ \ \ \ \ \
0
\times
\
textbf
{
h
}
(
\textrm
{
``都''
}
)
+
0
.
1
\times
\textbf
{
h
}
(
\textrm
{
`` 没''
}
)
+
..
$}}
;
\node
[anchor=north west] (formula) at ([xshift=-0.3
\hnode
,yshift=-1.5
\hnode
]attn11.south)
{
\small
{
不同
$
\
vectorn
{
C
}_
j
$
所对应的源语言词的权重是不同的
}}
;
\node
[anchor=north west] (example) at (formula.south west)
{
\footnotesize
{$
\
vectorn
{
C
}_
2
=
0
.
4
\times
\vectorn
{
h
}
(
\textrm
{
“你”
}
)
+
0
.
4
\times
\vectorn
{
h
}
(
\textrm
{
“什么”
}
)
+
$}}
;
\node
[anchor=north west] (example2) at ([yshift=0.4em]example.south west)
{
\footnotesize
{$
\ \ \ \ \ \ \ \
0
\times
\
vectorn
{
h
}
(
\textrm
{
“都”
}
)
+
0
.
1
\times
\vectorn
{
h
}
(
\textrm
{
“ 没”
}
)
+
..
$}}
;
}
%\visible<3->
...
...
@@ -138,12 +138,12 @@
%\visible<2->
{
\node
[anchor=west]
(sc1) at ([xshift=0.9
\hnode
]attn16.east)
{$
\
textbf
{
C
}_
1
=
\sum
_{
i
=
1
}^{
8
}
\alpha
_{
i
1
}
\textbf
{
h
}_{
i
}$}
;
\node
[anchor=west]
(sc1) at ([xshift=0.9
\hnode
]attn16.east)
{$
\
vectorn
{
C
}_
1
=
\sum
_{
i
=
1
}^{
8
}
\alpha
_{
i
1
}
\vectorn
{
h
}_{
i
}$}
;
}
%\visible<3->
{
\node
[anchor=west]
(sc2) at ([xshift=0.9
\hnode
,yshift=0.0
\hnode
]attn26.east)
{$
\
textbf
{
C
}_
2
=
\sum
_{
i
=
1
}^{
8
}
\alpha
_{
i
2
}
\textbf
{
h
}_{
i
}$}
;
\node
[anchor=west]
(sc2) at ([xshift=0.9
\hnode
,yshift=0.0
\hnode
]attn26.east)
{$
\
vectorn
{
C
}_
2
=
\sum
_{
i
=
1
}^{
8
}
\alpha
_{
i
2
}
\vectorn
{
h
}_{
i
}$}
;
}
\end{tikzpicture}
\ No newline at end of file
Chapter10/Figures/figure-gru01.tex
查看文件 @
08a7bd70
...
...
@@ -78,8 +78,8 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at (aux71)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at (aux71)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\end{scope}
...
...
Chapter10/Figures/figure-gru02.tex
查看文件 @
08a7bd70
...
...
@@ -91,8 +91,8 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at (aux71)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at (aux71)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\end{scope}
...
...
Chapter10/Figures/figure-gru03.tex
查看文件 @
08a7bd70
...
...
@@ -109,11 +109,11 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at (aux71)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at (aux71)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
{
\node
[wordnode,anchor=east]
() at (aux87)
{$
\
mathbf
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at (aux78)
{$
\
mathbf
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=east]
() at (aux87)
{$
\
vectorn
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at (aux78)
{$
\
vectorn
{
h
}_{
t
}$}
;
}
\end{scope}
...
...
Chapter10/Figures/figure-lstm01.tex
查看文件 @
08a7bd70
...
...
@@ -84,9 +84,9 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
mathbf
{
c
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
vectorn
{
c
}_{
t
-
1
}$}
;
\end{scope}
...
...
Chapter10/Figures/figure-lstm02.tex
查看文件 @
08a7bd70
...
...
@@ -99,9 +99,9 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
mathbf
{
c
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
vectorn
{
c
}_{
t
-
1
}$}
;
\end{scope}
...
...
Chapter10/Figures/figure-lstm03.tex
查看文件 @
08a7bd70
...
...
@@ -113,11 +113,11 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
mathbf
{
c
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
vectorn
{
c
}_{
t
-
1
}$}
;
{
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux59)
{$
\
mathbf
{
c
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux59)
{$
\
vectorn
{
c
}_{
t
}$}
;
}
\end{scope}
...
...
Chapter10/Figures/figure-lstm04.tex
查看文件 @
08a7bd70
...
...
@@ -131,15 +131,15 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
mathbf
{
c
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
vectorn
{
c
}_{
t
-
1
}$}
;
{
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux59)
{$
\
mathbf
{
c
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux59)
{$
\
vectorn
{
c
}_{
t
}$}
;
}
{
\node
[wordnode,anchor=east]
() at (aux68)
{$
\
mathbf
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux29)
{$
\
mathbf
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=east]
() at (aux68)
{$
\
vectorn
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux29)
{$
\
vectorn
{
h
}_{
t
}$}
;
}
\end{scope}
...
...
Chapter10/Figures/figure-output-layer-structur.tex
查看文件 @
08a7bd70
...
...
@@ -123,7 +123,7 @@
\draw
[->,thick] ([xshift=0.2em,yshift=0.1em]hidden.north west) -- (target.south west);
\draw
[->,thick] ([xshift=-0.2em,yshift=0.1em]hidden.north east) -- (target.south east);
\node
[anchor=south] () at ([yshift=0.3em]hidden.north)
{
\scriptsize
{$
\hat
{
\
mathbf
{
s
}}
=
\mathbf
{
Ws
}$}}
;
\node
[anchor=south] () at ([yshift=0.3em]hidden.north)
{
\scriptsize
{$
\hat
{
\
vectorn
{
s
}}
=
\vectorn
{
Ws
}$}}
;
}
{
...
...
Chapter10/Figures/figure-query-model-corresponding-to-attention-mechanism.tex
查看文件 @
08a7bd70
...
...
@@ -12,17 +12,17 @@
\tikzstyle
{
rnode
}
= [draw,minimum width=3.5em,minimum height=1.2em]
\node
[rnode,anchor=south west,fill=red!20!white] (value1) at (0,0)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``你''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value2) at ([xshift=1em]value1.south east)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``什么''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value3) at ([xshift=1em]value2.south east)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``也''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value4) at ([xshift=1em]value3.south east)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``没''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value1) at (0,0)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“你”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value2) at ([xshift=1em]value1.south east)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“什么”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value3) at ([xshift=1em]value2.south east)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“也”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value4) at ([xshift=1em]value3.south east)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“没”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key1) at ([yshift=0.2em]value1.north west)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``你''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key2) at ([yshift=0.2em]value2.north west)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``什么''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key3) at ([yshift=0.2em]value3.north west)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``也''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key4) at ([yshift=0.2em]value4.north west)
{
\scriptsize
{$
\
textbf
{
h
}
(
\textrm
{
``没''
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key1) at ([yshift=0.2em]value1.north west)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“你”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key2) at ([yshift=0.2em]value2.north west)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“什么”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key3) at ([yshift=0.2em]value3.north west)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“也”
}
)
$}}
;
\node
[rnode,anchor=south west,fill=green!20!white] (key4) at ([yshift=0.2em]value4.north west)
{
\scriptsize
{$
\
vectorn
{
h
}
(
\textrm
{
“没”
}
)
$}}
;
\node
[rnode,anchor=east] (query) at ([xshift=-2em]key1.west)
{
\scriptsize
{$
\
textbf
{
s
}
(
\textrm
{
``you''
}
)
$}}
;
\node
[rnode,anchor=east] (query) at ([xshift=-2em]key1.west)
{
\scriptsize
{$
\
vectorn
{
s
}
(
\textrm
{
“you”
}
)
$}}
;
\node
[anchor=east] (querylabel) at ([xshift=-0.2em]query.west)
{
\scriptsize
{
query
}}
;
\draw
[->] ([yshift=1pt,xshift=6pt]query.north) .. controls +(90:1em) and +(90:1em) .. ([yshift=1pt]key1.north);
...
...
Chapter10/Figures/figure-the-whole-of-lstm.tex
查看文件 @
08a7bd70
...
...
@@ -141,15 +141,15 @@
\end{scope}
\begin{scope}
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
mathbf
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
mathbf
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
mathbf
{
c
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux21)
{$
\
vectorn
{
h
}_{
t
-
1
}$}
;
\node
[wordnode,anchor=west]
() at (aux12)
{$
\
vectorn
{
x
}_
t
$}
;
\node
[wordnode,anchor=south]
() at ([xshift=0.5
\base
]aux51)
{$
\
vectorn
{
c
}_{
t
-
1
}$}
;
{
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux59)
{$
\
mathbf
{
c
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux59)
{$
\
vectorn
{
c
}_{
t
}$}
;
}
{
\node
[wordnode,anchor=east]
() at (aux68)
{$
\
mathbf
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux29)
{$
\
mathbf
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=east]
() at (aux68)
{$
\
vectorn
{
h
}_{
t
}$}
;
\node
[wordnode,anchor=south]
() at ([xshift=-0.5
\base
]aux29)
{$
\
vectorn
{
h
}_{
t
}$}
;
}
\end{scope}
...
...
@@ -170,19 +170,19 @@
\begin{scope}
{
% forget gate formula
\node
[formulanode,anchor=south east,text width=10em]
() 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=10em]
() at ([shift=
{
(4
\base
,1.5
\base
)
}
]aux51)
{
遗忘门
\\
$
\
vectorn
{
f
}_
t
=
\sigma
(
\vectorn
{
W
}_
f
[
\vectorn
{
h
}_{
t
-
1
}
,
\vectorn
{
x
}_
t
]+
\vectorn
{
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,text width=10em]
() at ([shift=
{
(4
\base
,-1.5
\base
)
}
]aux21)
{
输入门
\\
$
\
vectorn
{
i
}_
t
=
\sigma
(
\vectorn
{
W
}_
i
[
\vectorn
{
h
}_{
t
-
1
}
,
\vectorn
{
x
}_
t
]+
\vectorn
{
b
}_
i
)
$
\\
$
\hat
{
\vectorn
{
c
}}_
t
=
\mathrm
{
tanh
}
(
\vectorn
{
W
}_
c
[
\vectorn
{
h
}_{
t
-
1
}
,
\vectorn
{
x
}_
t
]+
\vectorn
{
b
}_
c
)
$}
;
}
{
% cell update formula
\node
[formulanode,anchor=south west,text width=10em]
() 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=10em]
() at ([shift=
{
(-4
\base
,1.5
\base
)
}
]aux59)
{
记忆更新
\\
$
\
vectorn
{
c
}_{
t
}
=
\vectorn
{
f
}_
t
\cdot
\vectorn
{
c
}_{
t
-
1
}
+
\vectorn
{
i
}_
t
\cdot
\hat
{
\vectorn
{
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,text width=10em]
() at ([shift=
{
(-4
\base
,-1.5
\base
)
}
]aux29)
{
输出门
\\
$
\
vectorn
{
o
}_
t
=
\sigma
(
\vectorn
{
W
}_
o
[
\vectorn
{
h
}_{
t
-
1
}
,
\vectorn
{
x
}_
t
]+
\vectorn
{
b
}_
o
)
$
\\
$
\vectorn
{
h
}_{
t
}
=
\vectorn
{
o
}_
t
\cdot
\mathrm
{
tanh
}
(
\vectorn
{
c
}_{
t
}
)
$}
;
}
\end{scope}
\end{tikzpicture}
...
...
Chapter10/Figures/figure-word-embedding-structure.tex
查看文件 @
08a7bd70
...
...
@@ -14,9 +14,9 @@
\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
()
$}}
;
\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
[]
(enclabel1) at (enc1)
{
\tiny
{$
\
textbf
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel2) at (enc2)
{
\tiny
{$
\
textbf
{
h
}_{
m
-
1
}$}}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel3) at (enc3)
{
\tiny
{$
\
textbf
{
h
}_{
m
}$}}
;
\node
[]
(enclabel1) at (enc1)
{
\tiny
{$
\
vectorn
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel2) at (enc2)
{
\tiny
{$
\
vectorn
{
h
}_{
m
-
1
}$}}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel3) at (enc3)
{
\tiny
{$
\
vectorn
{
h
}_{
m
}$}}
;
\node
[wordnode,left=0.4\base of enc1]
(init1)
{$
\cdots
$}
;
\node
[wordnode,left=0.4\base of eemb1]
(init2)
{$
\cdots
$}
;
...
...
@@ -28,7 +28,7 @@
\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
()
$}}
;
\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
{$
\
textbf
{
s
}_
\x
$}}}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.3
\base
]demb
\x
.north)
{{
\tiny
{$
\
vectorn
{
s
}_
\x
$}}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south]
(softmax
\x
) at ([yshift=0.3
\base
]dec
\x
.north)
{
\tiny
{
Softmax
}}
;
\node
[wordnode,right=0.4\base of demb3]
(end1)
{$
\cdots
$}
;
...
...
Chapter10/chapter10.tex
查看文件 @
08a7bd70
This source diff could not be displayed because it is too large. You can
view the blob
instead.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论