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
0714800c
Commit
0714800c
authored
Mar 09, 2021
by
孟霞
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'mengxia' 到 'caorunzhe'
14编辑修改 查看合并请求
!1058
parents
9efc1b10
1466c358
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
20 行删除
+20
-20
Chapter14/Figures/figure-comparison-of-different-attention-method.tex
+20
-20
Chapter14/chapter14.tex
+0
-0
没有找到文件。
Chapter14/Figures/figure-comparison-of-different-attention-method.tex
查看文件 @
0714800c
...
...
@@ -23,11 +23,11 @@
\node
[attnnode,anchor=south]
(attn11) at ([yshift=0.1
\hnode
]layer11.south)
{}
;
\node
[anchor=north west,inner sep=4pt,font=\small]
() at (attn11.north west)
{
注意力
}
;
\node
[anchor=south,inner sep=0pt]
(out11) at ([yshift=0.3
\hseg
]attn11.north)
{$
\cdots
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue,text=black]
(q11) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn11.south west)
{$
Q
^
n
$}
;
\node
[thinnode,anchor=south,thick,draw=orange,text=black]
(k11) at ([yshift=0.2
\hseg
]attn11.south)
{$
K
^
n
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple,text=black]
(v11) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn11.south east)
{$
V
^
n
$}
;
\node
[fatnode,anchor=south,thick,draw]
(s11) at ([xshift=0.5
\wseg
,yshift=0.8
\hseg
]q11.north east)
{$
S
^
n
\!
=
\!
S
(
Q
^
n
\!\cdot\!
K
^
n
)
$}
;
\node
[fatnode,anchor=south,thick,draw]
(a11) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k11.north east)
{$
A
^
n
\!
=
\!
S
^
n
\!\cdot\!
V
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue,text=black]
(q11) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn11.south west)
{$
{
\mathbi
Q
}
^
n
$}
;
\node
[thinnode,anchor=south,thick,draw=orange,text=black]
(k11) at ([yshift=0.2
\hseg
]attn11.south)
{$
{
\mathbi
K
}
^
n
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple,text=black]
(v11) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn11.south east)
{$
{
\mathbi
V
}
^
n
$}
;
\node
[fatnode,anchor=south,thick,draw]
(s11) at ([xshift=0.5
\wseg
,yshift=0.8
\hseg
]q11.north east)
{$
{
\mathbi
S
}^
n
\!
=
\!
{
\mathbi
S
}
(
{
\mathbi
Q
}^
n
\!\cdot\!
{
\mathbi
K
}
^
n
)
$}
;
\node
[fatnode,anchor=south,thick,draw]
(a11) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k11.north east)
{$
{
\mathbi
A
}^
n
\!
=
\!
{
\mathbi
S
}^
n
\!\cdot\!
{
\mathbi
V
}
$}
;
\begin{scope}
[fill=black!100]
\draw
[-latex',thick,draw=black!100]
(q11.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s11.south);
\draw
[-latex',thick,draw=black!100]
(k11.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s11.south);
...
...
@@ -43,11 +43,11 @@
\node
[attnnode,anchor=south]
(attn12) at ([yshift=0.1
\hnode
]layer12.south)
{}
;
\node
[anchor=north west,inner sep=4pt,font=\small]
() at (attn12.north west)
{
注意力
}
;
\node
[anchor=south,inner sep=0pt]
(out12) at ([yshift=0.3
\hseg
]attn12.north)
{$
\cdots
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue!40,text=black!40]
(q12) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn12.south west)
{$
Q
^
n
$}
;
\node
[thinnode,anchor=south,thick,draw=orange!40,text=black!40]
(k12) at ([yshift=0.2
\hseg
]attn12.south)
{$
K
^
n
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple,text=black]
(v12) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn12.south east)
{$
V
^
n
$}
;
\node
[fatnode,anchor=south,thick,densely dashed,draw]
(s12) at ([xshift=0.5
\wseg
,yshift=0.8
\hseg
]q12.north east)
{$
S
^
n
\!
=
\!
S
^
m
$}
;
\node
[fatnode,anchor=south,thick,draw]
(a12) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k12.north east)
{$
A
^
n
\!
=
\!
S
^
n
\!\cdot\!
V
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue!40,text=black!40]
(q12) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn12.south west)
{$
{
\mathbi
Q
}
^
n
$}
;
\node
[thinnode,anchor=south,thick,draw=orange!40,text=black!40]
(k12) at ([yshift=0.2
\hseg
]attn12.south)
{$
{
\mathbi
K
}
^
n
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple,text=black]
(v12) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn12.south east)
{$
{
\mathbi
V
}
^
n
$}
;
\node
[fatnode,anchor=south,thick,densely dashed,draw]
(s12) at ([xshift=0.5
\wseg
,yshift=0.8
\hseg
]q12.north east)
{$
{
\mathbi
S
}^
n
\!
=
\!
{
\mathbi
S
}
^
m
$}
;
\node
[fatnode,anchor=south,thick,draw]
(a12) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k12.north east)
{$
{
\mathbi
A
}^
n
\!
=
\!
{
\mathbi
S
}^
n
\!\cdot\!
{
\mathbi
V
}
$}
;
\begin{scope}
[fill=black!40]
\draw
[-latex',thick,draw=black!40]
(q12.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s12.south);
\draw
[-latex',thick,draw=black!40]
(k12.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s12.south);
...
...
@@ -63,11 +63,11 @@
\node
[attnnode,anchor=south]
(attn13) at ([yshift=0.1
\hnode
]layer13.south)
{}
;
\node
[anchor=north west,inner sep=4pt,font=\small]
() at (attn13.north west)
{
注意力
}
;
\node
[anchor=south,inner sep=0pt]
(out13) at ([yshift=0.3
\hseg
]attn13.north)
{$
\cdots
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue!40,text=black!40]
(q13) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn13.south west)
{$
Q
^
n
$}
;
\node
[thinnode,anchor=south,thick,draw=orange!40,text=black!40]
(k13) at ([yshift=0.2
\hseg
]attn13.south)
{$
K
^
n
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple!40,text=black!40]
(v13) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn13.south east)
{$
V
^
n
$}
;
\node
[fatnode,anchor=south,thick,draw=black!40,text=black!40]
(s13) at ([xshift=0.5
\wseg
,yshift=0.8
\hseg
]q13.north east)
{$
S
^
n
$}
;
\node
[fatnode,anchor=south,thick,densely dashed,draw]
(a13) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k13.north east)
{$
A
^
n
\!
=
\!
A
^
m
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue!40,text=black!40]
(q13) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn13.south west)
{$
{
\mathbi
Q
}
^
n
$}
;
\node
[thinnode,anchor=south,thick,draw=orange!40,text=black!40]
(k13) at ([yshift=0.2
\hseg
]attn13.south)
{$
{
\mathbi
K
}
^
n
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple!40,text=black!40]
(v13) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn13.south east)
{$
{
\mathbi
V
}
^
n
$}
;
\node
[fatnode,anchor=south,thick,draw=black!40,text=black!40]
(s13) at ([xshift=0.5
\wseg
,yshift=0.8
\hseg
]q13.north east)
{$
{
\mathbi
S
}
^
n
$}
;
\node
[fatnode,anchor=south,thick,densely dashed,draw]
(a13) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k13.north east)
{$
{
\mathbi
A
}^
n
\!
=
\!
{
\mathbi
A
}
^
m
$}
;
\begin{scope}
[fill=black!40]
\draw
[-latex',thick,draw=black!40]
(q13.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s13.south);
\draw
[-latex',thick,draw=black!40]
(k13.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s13.south);
...
...
@@ -87,11 +87,11 @@
\node
[anchor=north west,inner sep=4pt,font=\small]
() at (attn
\i\j
.north west)
{
注意力
}
;
\node
[anchor=south,inner sep=0pt]
(out
\i\j
) at ([yshift=0.3
\hseg
]attn
\i\j
.north)
{$
\cdots
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue!\q,text=black]
(q
\i\j
) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn
\i\j
.south west)
{$
Q
^
m
$}
;
\node
[thinnode,anchor=south,thick,draw=orange!\q,text=black]
(k
\i\j
) at ([yshift=0.2
\hseg
]attn
\i\j
.south)
{$
K
^
m
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple!\s,text=black]
(v
\i\j
) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn
\i\j
.south east)
{$
V
^
m
$}
;
\node
[fatnode,anchor=south,thick,draw=black!\s]
(s
\i\j
) at ([xshift=0.45
\wseg
,yshift=0.8
\hseg
]q
\i\j
.north east)
{$
S
^
m
\!
=
\!
S
(
Q
^
m
\!\cdot\!
K
^
m
)
$}
;
\node
[fatnode,anchor=south,thick,draw=black!80]
(a
\i\j
) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k
\i\j
.north east)
{$
A
^
m
\!
=
\!
S
^
m
\!\cdot\!
V
$}
;
\node
[thinnode,anchor=south west,thick,draw=dblue!\q,text=black]
(q
\i\j
) at ([xshift=0.1
\wseg
,yshift=0.2
\hseg
]attn
\i\j
.south west)
{$
{
\mathbi
Q
}
^
m
$}
;
\node
[thinnode,anchor=south,thick,draw=orange!\q,text=black]
(k
\i\j
) at ([yshift=0.2
\hseg
]attn
\i\j
.south)
{$
{
\mathbi
K
}
^
m
$}
;
\node
[thinnode,anchor=south east,thick,draw=purple!\s,text=black]
(v
\i\j
) at ([xshift=-0.1
\wseg
,yshift=0.2
\hseg
]attn
\i\j
.south east)
{$
{
\mathbi
V
}
^
m
$}
;
\node
[fatnode,anchor=south,thick,draw=black!\s]
(s
\i\j
) at ([xshift=0.45
\wseg
,yshift=0.8
\hseg
]q
\i\j
.north east)
{$
{
\mathbi
S
}^
m
\!
=
\!
{
\mathbi
S
}
(
{
\mathbi
Q
}^
m
\!\cdot\!
{
\mathbi
K
}
^
m
)
$}
;
\node
[fatnode,anchor=south,thick,draw=black!80]
(a
\i\j
) at ([xshift=0.45
\wseg
,yshift=1.3
\hseg
+0.6
\hnode
]k
\i\j
.north east)
{$
{
\mathbi
A
}^
m
\!
=
\!
{
\mathbi
S
}^
m
\!\cdot\!
{
\mathbi
V
}
$}
;
\begin{scope}
[fill=black!
\q
]
\draw
[-latex',thick,draw=black!\t]
(q
\i\j
.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s
\i\j
.south);
\draw
[-latex',thick,draw=black!\t]
(k
\i\j
.north) .. controls +(north:0.5
\hseg
) and +(south:0.8
\hseg
) .. (s
\i\j
.south);
...
...
Chapter14/chapter14.tex
查看文件 @
0714800c
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论