Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
Toy-MT-Introduction
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
NiuTrans
Toy-MT-Introduction
Commits
511e5866
Commit
511e5866
authored
May 09, 2020
by
zengxin
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'zengxin' 到 'caorunzhe'
chapter6 fig 查看合并请求
!102
parents
f61614e4
4dacb27e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
44 行增加
和
73 行删除
+44
-73
Book/Chapter6/Chapter6.tex
+0
-0
Book/Chapter6/Figures/Big learning rate vs Small learning rate.png
+0
-0
Book/Chapter6/Figures/figure-A-working-example-of-neural-machine-translation.tex
+11
-5
Book/Chapter6/Figures/figure-Calculation-of-context-vector-C.tex
+2
-1
Book/Chapter6/Figures/figure-Generate-summary.tex
+1
-1
Book/Chapter6/Figures/figure-Multi-Head-Attention-Model.tex
+14
-14
Book/Chapter6/Figures/figure-Point-product-attention-model.tex
+4
-4
Book/Chapter6/Figures/figure-Query-model-corresponding-to-traditional-query-model-vs-attention-mechanism.tex
+0
-40
Book/Chapter6/Figures/figure-convergence&lr.tex
+6
-6
Book/Chapter6/Figures/figure-transformer.tex
+4
-0
Book/mt-book-xelatex.tex
+2
-2
没有找到文件。
Book/Chapter6/Chapter6.tex
查看文件 @
511e5866
差异被折叠。
点击展开。
Book/Chapter6/Figures/Big learning rate vs Small learning rate.png
deleted
100644 → 0
查看文件 @
f61614e4
18.4 KB
Book/Chapter6/Figures/figure-A-working-example-of-neural-machine-translation.tex
查看文件 @
511e5866
...
@@ -4,12 +4,13 @@
...
@@ -4,12 +4,13 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}
\begin{tikzpicture}
\setlength
{
\base
}{
0.9cm
}
\setlength
{
\base
}{
0.9cm
}
\tikzstyle
{
rnnnode
}
= [rounded corners=1pt,minimum size=0.5
\base
,draw,inner sep=0pt,outer sep=0pt]
\tikzstyle
{
rnnnode
}
= [rounded corners=1pt,minimum size=0.5
\base
,draw,inner sep=0pt,outer sep=0pt]
\tikzstyle
{
wordnode
}
= [font=
\
tiny
]
\tikzstyle
{
wordnode
}
= [font=
\
scriptsize
]
% RNN translation model
% RNN translation model
\begin{scope}
[local bounding box=RNNMT]
\begin{scope}
[local bounding box=RNNMT]
...
@@ -23,8 +24,12 @@
...
@@ -23,8 +24,12 @@
\node
[wordnode,anchor=east]
(init2) at ([xshift=-3.0em]init.west)
{}
;
\node
[wordnode,anchor=east]
(init2) at ([xshift=-3.0em]init.west)
{}
;
{
{
\node
[rnnnode,fill=purple]
(repr) at (enc4)
{}
;
\node
[rnnnode,fill=purple]
(repr) at (enc4)
{}
;
\node
[wordnode]
(label) at ([xshift=3.5em]enc4.east)
{
源语言句子表示
}
;
\node
[wordnode]
(label) at ([yshift=2.5em]enc4.north)
{
\draw
[->,dashed,thick]
(label.west) -- (enc4.east);
\begin{tabular}
{
c
}
源语言句
\\
子表示
\end{tabular}
}
;
\draw
[->,dashed,thick]
(label.south) -- (enc4.north);
}
}
\node
[wordnode,below=0pt of eemb1,font=\scriptsize]
(encwordin1)
{
我
}
;
\node
[wordnode,below=0pt of eemb1,font=\scriptsize]
(encwordin1)
{
我
}
;
...
@@ -37,7 +42,7 @@
...
@@ -37,7 +42,7 @@
% RNN Decoder
% RNN Decoder
\foreach
\x
in
{
1,2,...,4
}
\foreach
\x
in
{
1,2,...,4
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([xshift=
0.0em,yshift=3.0
em]enc
\x
.north)
{}
;
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([xshift=
9.0em,yshift=-3.5
em]enc
\x
.north)
{}
;
\foreach
\x
in
{
1,2,...,4
}
\foreach
\x
in
{
1,2,...,4
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.5
\base
]demb
\x
.north)
{}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.5
\base
]demb
\x
.north)
{}
;
\foreach
\x
in
{
1,2,...,4
}
\foreach
\x
in
{
1,2,...,4
}
...
@@ -86,7 +91,7 @@
...
@@ -86,7 +91,7 @@
\draw
[-latex']
(dec
\x
.east) to (dec
\y
.west);
\draw
[-latex']
(dec
\x
.east) to (dec
\y
.west);
}
}
\coordinate
(bridge) at ([yshift=-1.15
\base
]demb2);
\coordinate
(bridge) at ([yshift=-1.15
\base
]demb2);
\draw
[-latex']
(enc4.
north) .. controls +(north:0.4
\base
) and +(east:0.5
\base
) .. (bridge) .. controls +(west:2.4
\base
) and +(west:0.5
\base
) ..
(dec1.west);
\draw
[-latex']
(enc4.
east) --
(dec1.west);
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
...
@@ -124,3 +129,4 @@
...
@@ -124,3 +129,4 @@
Book/Chapter6/Figures/figure-Calculation-of-context-vector-C.tex
查看文件 @
511e5866
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
\vspace
{
-1.0em
}
\vspace
{
-1.0em
}
\footnotesize
{
\footnotesize
{
\begin{eqnarray}
\begin{eqnarray}
\t
extbf
{
C
}
(
\textrm
{
''机票''
}
)
&
=
&
0.2
\times
\textbf
{
h
}
(
\textrm
{
``沈阳''
}
) + 0.3
\times
\textbf
{
h
}
(
\textrm
{
``到''
}
) +
\nonumber
\\
\t
ilde
{
\mathbf
{
h
}}
(
\textrm
{
''机票''
}
)
&
=
&
0.2
\times
\textbf
{
h
}
(
\textrm
{
``沈阳''
}
) + 0.3
\times
\textbf
{
h
}
(
\textrm
{
``到''
}
) +
\nonumber
\\
&
&
0.1
\times
\textbf
{
h
}
(
\textrm
{
``广州''
}
) + ... + 0.3
\times
\textbf
{
h
}
(
\textrm
{
``机票''
}
)
\nonumber
&
&
0.1
\times
\textbf
{
h
}
(
\textrm
{
``广州''
}
) + ... + 0.3
\times
\textbf
{
h
}
(
\textrm
{
``机票''
}
)
\nonumber
\end{eqnarray}
\end{eqnarray}
}
}
\ No newline at end of file
Book/Chapter6/Figures/figure-Generate-summary.tex
查看文件 @
511e5866
...
@@ -16,7 +16,7 @@ Jenson Button was denied his 100th race for McLaren after an ERS prevented him f
...
@@ -16,7 +16,7 @@ Jenson Button was denied his 100th race for McLaren after an ERS prevented him f
}
;
}
;
%译文1--------------mt1
%译文1--------------mt1
\node
[font=\small]
(mt1) at ([xshift=0em,yshift=-16.8em]original0.south)
{
系统生成
\quad
}
;
\node
[font=\small]
(mt1) at ([xshift=0em,yshift=-16.8em]original0.south)
{
系统生成
\quad
}
;
\node
[font=\small]
(mt-2) at ([xshift=0em,yshift=-0.5em]mt1.south)
{
\quad
的摘要:
}
;
\node
[font=\small]
(mt-2) at ([xshift=0em,yshift=-0.5em]mt1.south)
{
的摘要:
\quad
}
;
\node
[font=\small]
(ts1) at ([xshift=0em,yshift=-3em]original1.south)
{
\node
[font=\small]
(ts1) at ([xshift=0em,yshift=-3em]original1.south)
{
\begin{tabular}
[t]
{
l
}
\begin{tabular}
[t]
{
l
}
\parbox
{
32em
}{
\parbox
{
32em
}{
...
...
Book/Chapter6/Figures/figure-Multi-Head-Attention-Model.tex
查看文件 @
511e5866
...
@@ -4,28 +4,28 @@
...
@@ -4,28 +4,28 @@
\begin{tikzpicture}
\begin{tikzpicture}
\begin{scope}
\begin{scope}
\node
[anchor=west,draw=black!30,inner sep=4pt,fill=ugreen!20!white] (Linear0) at (0,0)
{
\
tiny
{
Linear
}}
;
\node
[anchor=west,draw=black!30,inner sep=4pt,fill=ugreen!20!white] (Linear0) at (0,0)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=south west,draw=black!50,fill=ugreen!20!white,draw,inner sep=4pt] (Linear01) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear0.south west)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south west,draw=black!50,fill=ugreen!20!white,draw,inner sep=4pt] (Linear01) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear0.south west)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=south west,fill=ugreen!20!white,draw,inner sep=4pt] (Linear02) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear01.south west)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south west,fill=ugreen!20!white,draw,inner sep=4pt] (Linear02) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear01.south west)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=north] (Q) at ([xshift=0em,yshift=-1em]Linear02.south)
{
\footnotesize
{$
\mathbf
{
Q
}$}}
;
\node
[anchor=north] (Q) at ([xshift=0em,yshift=-1em]Linear02.south)
{
\footnotesize
{$
\mathbf
{
Q
}$}}
;
\node
[anchor=west,draw=black!30,inner sep=4pt,fill=ugreen!20!white] (Linear1) at ([xshift=1.5em]Linear0.east)
{
\
tiny
{
Linear
}}
;
\node
[anchor=west,draw=black!30,inner sep=4pt,fill=ugreen!20!white] (Linear1) at ([xshift=1.5em]Linear0.east)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=south west,draw=black!50,fill=ugreen!20!white,draw,inner sep=4pt] (Linear11) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear1.south west)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south west,draw=black!50,fill=ugreen!20!white,draw,inner sep=4pt] (Linear11) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear1.south west)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=south west,fill=ugreen!20!white,draw,inner sep=4pt] (Linear12) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear11.south west)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south west,fill=ugreen!20!white,draw,inner sep=4pt] (Linear12) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear11.south west)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=north] (K) at ([xshift=0em,yshift=-1em]Linear12.south)
{
\footnotesize
{$
\mathbf
{
K
}$}}
;
\node
[anchor=north] (K) at ([xshift=0em,yshift=-1em]Linear12.south)
{
\footnotesize
{$
\mathbf
{
K
}$}}
;
\node
[anchor=west,draw=black!30,inner sep=4pt,fill=ugreen!20!white] (Linear2) at ([xshift=1.5em]Linear1.east)
{
\
tiny
{
Linear
}}
;
\node
[anchor=west,draw=black!30,inner sep=4pt,fill=ugreen!20!white] (Linear2) at ([xshift=1.5em]Linear1.east)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=south west,draw=black!50,fill=ugreen!20!white,draw,inner sep=4pt] (Linear21) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear2.south west)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south west,draw=black!50,fill=ugreen!20!white,draw,inner sep=4pt] (Linear21) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear2.south west)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=south west,fill=ugreen!20!white,draw,inner sep=4pt] (Linear22) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear21.south west)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south west,fill=ugreen!20!white,draw,inner sep=4pt] (Linear22) at ([shift=
{
(-0.2em,-0.2em)
}
]Linear21.south west)
{
\
footnotesize
{
Linear
}}
;
\node
[anchor=north] (V) at ([xshift=0em,yshift=-1em]Linear22.south)
{
\footnotesize
{$
\mathbf
{
V
}$}}
;
\node
[anchor=north] (V) at ([xshift=0em,yshift=-1em]Linear22.south)
{
\footnotesize
{$
\mathbf
{
V
}$}}
;
\node
[anchor=south,draw=black!30,minimum width=
9em,inner sep=4pt,fill=blue!20!white] (Scale) at ([yshift=1em]Linear1.north)
{
\tiny
{
Scaled Dot-Product Attention
}}
;
\node
[anchor=south,draw=black!30,minimum width=
12em,minimum height=2em,inner sep=4pt,fill=blue!20!white] (Scale) at ([yshift=1em]Linear1.north)
{
\footnotesize
{
Scaled Dot-Product Attention
}}
;
\node
[anchor=south west,draw=black!50,minimum width=
9em,fill=blue!20!white,draw,inner sep=4pt] (Scale1) at ([shift=
{
(-0.2em,-0.2em)
}
]Scale.south west)
{
\tiny
{
Scaled Dot-Product Attention
}}
;
\node
[anchor=south west,draw=black!50,minimum width=
12em,minimum height=2em,fill=blue!20!white,draw,inner sep=4pt] (Scale1) at ([shift=
{
(-0.2em,-0.2em)
}
]Scale.south west)
{
\footnotesize
{
Scaled Dot-Product Attention
}}
;
\node
[anchor=south west,fill=blue!20!white,draw,minimum width=
9em,inner sep=4pt] (Scale2) at ([shift=
{
(-0.2em,-0.2em)
}
]Scale1.south west)
{
\tiny
{
Scaled Dot-Product Attention
}}
;
\node
[anchor=south west,fill=blue!20!white,draw,minimum width=
12em,minimum height=2em,inner sep=4pt] (Scale2) at ([shift=
{
(-0.2em,-0.2em)
}
]Scale1.south west)
{
\footnotesize
{
Scaled Dot-Product Attention
}}
;
\node
[anchor=south,draw,minimum width=4em,inner sep=4pt,fill=yellow!30] (Concat) at ([yshift=1em]Scale2.north)
{
\
tiny
{
Concat
}}
;
\node
[anchor=south,draw,minimum width=4em,inner sep=4pt,fill=yellow!30] (Concat) at ([yshift=1em]Scale2.north)
{
\
footnotesize
{
Concat
}}
;
\node
[anchor=south,draw,minimum width=4em,inner sep=4pt,fill=ugreen!20!white] (Linear) at ([yshift=1em]Concat.north)
{
\
tiny
{
Linear
}}
;
\node
[anchor=south,draw,minimum width=4em,inner sep=4pt,fill=ugreen!20!white] (Linear) at ([yshift=1em]Concat.north)
{
\
footnotesize
{
Linear
}}
;
\draw
[->] ([yshift=0.1em]Q.north) -- ([yshift=-0.1em]Linear02.south);
\draw
[->] ([yshift=0.1em]Q.north) -- ([yshift=-0.1em]Linear02.south);
...
...
Book/Chapter6/Figures/figure-Point-product-attention-model.tex
查看文件 @
511e5866
...
@@ -23,11 +23,11 @@
...
@@ -23,11 +23,11 @@
\draw
[->] ([yshift=0.1em]Scale3.north) -- ([yshift=-0.1em]Mask.south);
\draw
[->] ([yshift=0.1em]Scale3.north) -- ([yshift=-0.1em]Mask.south);
\draw
[->] ([yshift=0.1em]Mask.north) -- ([yshift=-0.1em]SoftMax.south);
\draw
[->] ([yshift=0.1em]Mask.north) -- ([yshift=-0.1em]SoftMax.south);
\draw
[->] ([yshift=0.1em]SoftMax.north) -- ([yshift=0.9em]SoftMax.north);
\draw
[->] ([yshift=0.1em]SoftMax.north) -- ([yshift=0.9em]SoftMax.north);
\draw
[->] ([yshift=0.1em]V1.north) -- ([yshift=9.
1
em]V1.north);
\draw
[->] ([yshift=0.1em]V1.north) -- ([yshift=9.
3
em]V1.north);
\draw
[->] ([yshift=0.1em]MatMul1.north) -- ([yshift=0.8em]MatMul1.north);
\draw
[->] ([yshift=0.1em]MatMul1.north) -- ([yshift=0.8em]MatMul1.north);
{
{
\node
[anchor=east] (line1) at ([xshift=-
3
em,yshift=1em]MatMul.west)
{
\scriptsize
{
自注意力机制的Query
}}
;
\node
[anchor=east] (line1) at ([xshift=-
4
em,yshift=1em]MatMul.west)
{
\scriptsize
{
自注意力机制的Query
}}
;
\node
[anchor=north west] (line2) at ([yshift=0.3em]line1.south west)
{
\scriptsize
{
Key和Value均来自同一句子
}}
;
\node
[anchor=north west] (line2) at ([yshift=0.3em]line1.south west)
{
\scriptsize
{
Key和Value均来自同一句子
}}
;
\node
[anchor=north west] (line3) at ([yshift=0.3em]line2.south west)
{
\scriptsize
{
编码-解码注意力机制
}}
;
\node
[anchor=north west] (line3) at ([yshift=0.3em]line2.south west)
{
\scriptsize
{
编码-解码注意力机制
}}
;
\node
[anchor=north west] (line4) at ([yshift=0.3em]line3.south west)
{
\scriptsize
{
与前面讲的一样
}}
;
\node
[anchor=north west] (line4) at ([yshift=0.3em]line3.south west)
{
\scriptsize
{
与前面讲的一样
}}
;
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
{
{
\node
[rectangle,inner sep=0.2em,rounded corners=1pt,fill=green!10,drop shadow,draw=ugreen] [fit = (line1) (line2) (line3) (line4)] (box1)
{}
;
\node
[rectangle,inner sep=0.2em,rounded corners=1pt,fill=green!10,drop shadow,draw=ugreen] [fit = (line1) (line2) (line3) (line4)] (box1)
{}
;
\node
[rectangle,inner sep=0.1em,rounded corners=1pt,very thick,dotted,draw=ugreen] [fit = (Q1) (K1) (V1)] (box0)
{}
;
\node
[rectangle,inner sep=0.1em,rounded corners=1pt,very thick,dotted,draw=ugreen] [fit = (Q1) (K1) (V1)] (box0)
{}
;
\draw
[->,dotted,very thick,ugreen] ([yshift=-1.5em,xshift=
0.8
em]box1.east) -- ([yshift=-1.5em,xshift=0.1em]box1.east);
\draw
[->,dotted,very thick,ugreen] ([yshift=-1.5em,xshift=
1.2
em]box1.east) -- ([yshift=-1.5em,xshift=0.1em]box1.east);
}
}
{
{
\node
[rectangle,inner sep=0.2em,rounded corners=1pt,fill=blue!20!white,drop shadow,draw=blue] [fit = (line11) (line12) (line13)] (box2)
{}
;
\node
[rectangle,inner sep=0.2em,rounded corners=1pt,fill=blue!20!white,drop shadow,draw=blue] [fit = (line11) (line12) (line13)] (box2)
{}
;
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
{
{
\node
[rectangle,inner sep=0.2em,rounded corners=1pt,fill=red!10,drop shadow,draw=red] [fit = (line31) (line32) (line33) (line34)] (box4)
{}
;
\node
[rectangle,inner sep=0.2em,rounded corners=1pt,fill=red!10,drop shadow,draw=red] [fit = (line31) (line32) (line33) (line34)] (box4)
{}
;
\draw
[->,dotted,very thick,red] ([yshift=-1.
5em,xshift=1.5em]box4.east) -- ([yshift=-1.5
em,xshift=0.1em]box4.east);
\draw
[->,dotted,very thick,red] ([yshift=-1.
2em,xshift=2.2em]box4.east) -- ([yshift=-1.2
em,xshift=0.1em]box4.east);
}
}
{
{
...
...
Book/Chapter6/Figures/figure-Query-model-corresponding-to-traditional-query-model-vs-attention-mechanism.tex
查看文件 @
511e5866
...
@@ -28,46 +28,7 @@
...
@@ -28,46 +28,7 @@
\draw
[->] ([yshift=1pt]query.north) .. controls +(90:2em) and +(90:2em) .. ([yshift=1pt]key3.north) node [pos=0.5,below,yshift=0.2em]
{
\scriptsize
{
匹配
}}
;
\draw
[->] ([yshift=1pt]query.north) .. controls +(90:2em) and +(90:2em) .. ([yshift=1pt]key3.north) node [pos=0.5,below,yshift=0.2em]
{
\scriptsize
{
匹配
}}
;
\node
[anchor=north] (result) at (value3.south)
{
\scriptsize
{
{
\red
返回结果
}
}}
;
\node
[anchor=north] (result) at (value3.south)
{
\scriptsize
{
{
\red
返回结果
}
}}
;
\node
[anchor=north] (result2) at ([xshift=-2em,yshift=-2em]value2.south)
{
\footnotesize
{
{
(a)索引的查询过程
}
}}
;
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
\begin{tikzpicture}
\begin{scope}
\tikzstyle
{
rnode
}
= [draw,minimum width=3em,minimum height=1.2em]
\node
[rnode,anchor=south west,fill=red!20!white] (value1) at (0,0)
{
\scriptsize
{
value
$_
1
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value2) at ([xshift=1em]value1.south east)
{
\scriptsize
{
value
$_
2
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value3) at ([xshift=1em]value2.south east)
{
\scriptsize
{
value
$_
3
$}}
;
\node
[rnode,anchor=south west,fill=red!20!white] (value4) at ([xshift=1em]value3.south east)
{
\scriptsize
{
value
$_
4
$}}
;
\node
[rnode,anchor=south west,pattern=north east lines] (key1) at ([yshift=0.2em]value1.north west)
{}
;
\node
[rnode,anchor=south west,pattern=dots] (key2) at ([yshift=0.2em]value2.north west)
{}
;
\node
[rnode,anchor=south west,pattern=horizontal lines] (key3) at ([yshift=0.2em]value3.north west)
{}
;
\node
[rnode,anchor=south west,pattern=crosshatch dots] (key4) at ([yshift=0.2em]value4.north west)
{}
;
\node
[fill=white,inner sep=1pt] (key1label) at (key1)
{
\scriptsize
{
key
$_
1
$}}
;
\node
[fill=white,inner sep=1pt] (key1label) at (key2)
{
\scriptsize
{
key
$_
2
$}}
;
\node
[fill=white,inner sep=1pt] (key1label) at (key3)
{
\scriptsize
{
key
$_
3
$}}
;
\node
[fill=white,inner sep=1pt] (key1label) at (key4)
{
\scriptsize
{
key
$_
4
$}}
;
\node
[rnode,anchor=east,pattern=vertical lines] (query) at ([xshift=-3em]key1.west)
{}
;
\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);
\draw
[->] ([yshift=1pt,xshift=3pt]query.north) .. controls +(90:1.5em) and +(90:1.5em) .. ([yshift=1pt]key2.north);
\draw
[->] ([yshift=1pt]query.north) .. controls +(90:2em) and +(90:2em) .. ([yshift=1pt]key3.north);
\draw
[->] ([yshift=1pt,xshift=-3pt]query.north) .. controls +(90:2.5em) and +(90:2.5em) .. ([yshift=1pt]key4.north);
\node
[anchor=south east] (alpha1) at (key1.north east)
{
\scriptsize
{$
\alpha
_
1
$}}
;
\node
[anchor=south east] (alpha2) at (key2.north east)
{
\scriptsize
{$
\alpha
_
2
$}}
;
\node
[anchor=south east] (alpha3) at (key3.north east)
{
\scriptsize
{$
\alpha
_
3
$}}
;
\node
[anchor=south east] (alpha4) at (key4.north east)
{
\scriptsize
{$
\alpha
_
4
$}}
;
\node
[anchor=north] (result) at ([xshift=-1.5em]value2.south east)
{
\scriptsize
{{
\red
返回结果
}
=
$
\alpha
_
1
\cdot
\textrm
{
value
}_
1
+
\alpha
_
2
\cdot
\textrm
{
value
}_
2
+
\alpha
_
3
\cdot
\textrm
{
value
}_
3
+
\alpha
_
4
\cdot
\textrm
{
value
}_
4
$}}
;
\node
[anchor=north] (result2) at ([xshift=-1em,yshift=-2.5em]value2.south)
{
\footnotesize
{
{
(b)注意力机制查询过程
}
}}
;
\end{scope}
\end{tikzpicture}
\ No newline at end of file
Book/Chapter6/Figures/figure-convergence&lr.tex
查看文件 @
511e5866
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
\begin{tikzpicture}
\begin{tikzpicture}
\begin{axis}
[
\begin{axis}
[
name=s1,
name=s1,
width=7cm, height=4cm,
width=7cm, height=4
.5
cm,
xtick=
{
-4,-3,-2,-1,0,1,2,3,4
}
,
xtick=
{
-4,-3,-2,-1,0,1,2,3,4
}
,
ytick=
{
0,1,...,4
}
,
ytick=
{
0,1,...,4
}
,
xticklabel style=
{
opacity=0
}
,
xticklabel style=
{
opacity=0
}
,
yticklabel style=
{
opacity=0
}
,
yticklabel style=
{
opacity=0
}
,
xlabel=
{$
w
$}
,
xlabel=
{$
w
$}
,
ylabel=
{$
L
(
w
)
$}
,
ylabel=
{$
L
(
w
)
$}
,
axis line style=
{
->
}
,
axis line style=
{
->
,very thick
}
,
xlabel style=
{
xshift=2.2cm,yshift=1.2cm
}
,
xlabel style=
{
xshift=2.2cm,yshift=1.2cm
}
,
ylabel style=
{
rotate=-90,xshift=1.5cm,yshift=1.6cm
}
,
ylabel style=
{
rotate=-90,xshift=1.5cm,yshift=1.6cm
}
,
tick align=inside,
tick align=inside,
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
xmin=-4,
xmin=-4,
xmax=4,
xmax=4,
ymin=0,
ymin=0,
ymax=4]
ymax=4
.5
]
\addplot
[dashed,ublue,thick]
{
x
^
2/4
}
;
\addplot
[dashed,ublue,thick]
{
x
^
2/4
}
;
\addplot
[quiver=
{
u=1,v=x/2,scale arrows = 0.25
}
,domain=-4:-0.3,->,samples=10,red!60,ultra thick]
{
x
^
2/4
}
;
\addplot
[quiver=
{
u=1,v=x/2,scale arrows = 0.25
}
,domain=-4:-0.3,->,samples=10,red!60,ultra thick]
{
x
^
2/4
}
;
\addplot
[draw=ublue,fill=red,mark=*] coordinates
{
(0,0)
}
;
\addplot
[draw=ublue,fill=red,mark=*] coordinates
{
(0,0)
}
;
...
@@ -29,14 +29,14 @@
...
@@ -29,14 +29,14 @@
anchor=south,
anchor=south,
xshift=6cm,
xshift=6cm,
yshift=0cm,
yshift=0cm,
width=7cm, height=4cm,
width=7cm, height=4
.5
cm,
xtick=
{
-4,-3,-2,-1,0,1,2,3,4
}
,
xtick=
{
-4,-3,-2,-1,0,1,2,3,4
}
,
ytick=
{
0,1,...,4
}
,
ytick=
{
0,1,...,4
}
,
xticklabel style=
{
opacity=0
}
,
xticklabel style=
{
opacity=0
}
,
yticklabel style=
{
opacity=0
}
,
yticklabel style=
{
opacity=0
}
,
xlabel=
{$
w
$}
,
xlabel=
{$
w
$}
,
ylabel=
{$
L
(
w
)
$}
,
ylabel=
{$
L
(
w
)
$}
,
axis line style=
{
->
}
,
axis line style=
{
->
,very thick
}
,
xlabel style=
{
xshift=2.2cm,yshift=1.2cm
}
,
xlabel style=
{
xshift=2.2cm,yshift=1.2cm
}
,
ylabel style=
{
rotate=-90,xshift=1.5cm,yshift=1.6cm
}
,
ylabel style=
{
rotate=-90,xshift=1.5cm,yshift=1.6cm
}
,
tick align=inside,
tick align=inside,
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
xmin=-4,
xmin=-4,
xmax=4,
xmax=4,
ymin=0,
ymin=0,
ymax=4]
ymax=4
.5
]
\addplot
[dashed,ublue,thick]
{
x
^
2/4
}
;
\addplot
[dashed,ublue,thick]
{
x
^
2/4
}
;
\addplot
[quiver=
{
u=-x-(x/abs(x))*(1+x
^
2-4)
^
(1/2),v=-0.7
}
,domain=-4:3.6,->,samples=2,red!60,ultra thick]
{
x
^
2/4
}
;
\addplot
[quiver=
{
u=-x-(x/abs(x))*(1+x
^
2-4)
^
(1/2),v=-0.7
}
,domain=-4:3.6,->,samples=2,red!60,ultra thick]
{
x
^
2/4
}
;
\addplot
[quiver=
{
u=-x-(x/abs(x))*(1+x
^
2-4)
^
(1/2),v=-0.7
}
,domain=-3.13:2.6,->,samples=2,red!60,ultra thick]
{
x
^
2/4
}
;
\addplot
[quiver=
{
u=-x-(x/abs(x))*(1+x
^
2-4)
^
(1/2),v=-0.7
}
,domain=-3.13:2.6,->,samples=2,red!60,ultra thick]
{
x
^
2/4
}
;
...
...
Book/Chapter6/Figures/figure-transformer.tex
查看文件 @
511e5866
...
@@ -62,5 +62,8 @@
...
@@ -62,5 +62,8 @@
\node
[rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=ugreen!70] [fit = (sa1) (res1) (ffn1) (res2)] (box0)
{}
;
\node
[rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=ugreen!70] [fit = (sa1) (res1) (ffn1) (res2)] (box0)
{}
;
\node
[rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=red!60] [fit = (sa2) (res3) (res5)] (box1)
{}
;
\node
[rectangle,inner sep=0.7em,rounded corners=1pt,very thick,dotted,draw=red!60] [fit = (sa2) (res3) (res5)] (box1)
{}
;
\node
[ugreen] (count) at ([xshift=-1.7em,yshift=-1em]encoder.south)
{$
6
\times
$}
;
\node
[red] (count) at ([xshift=11em,yshift=0em]decoder.south)
{$
\times
6
$}
;
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
\ No newline at end of file
Book/mt-book-xelatex.tex
查看文件 @
511e5866
...
@@ -127,8 +127,8 @@
...
@@ -127,8 +127,8 @@
%\include{Chapter3/chapter3}
%\include{Chapter3/chapter3}
%\include{Chapter4/chapter4}
%\include{Chapter4/chapter4}
%\include{Chapter5/chapter5}
%\include{Chapter5/chapter5}
%
\include{Chapter6/chapter6}
\include
{
Chapter6/chapter6
}
\include
{
Chapter7/chapter7
}
%
\include{Chapter7/chapter7}
%\include{ChapterAppend/chapterappend}
%\include{ChapterAppend/chapterappend}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论