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
4c6d9f54
Commit
4c6d9f54
authored
Dec 15, 2020
by
孟霞
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'mengxia' 到 'caorunzhe'
Mengxia 查看合并请求
!607
parents
bb9cf4f3
202c8af5
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
144 行增加
和
5 行删除
+144
-5
Chapter17/Figures/figure-cache.tex
+58
-0
Chapter17/Figures/figure-layer.tex
+81
-0
Chapter17/Figures/figure-multiencoder.tex
+5
-5
Chapter17/chapter17.tex
+0
-0
没有找到文件。
Chapter17/Figures/figure-cache.tex
0 → 100644
查看文件 @
4c6d9f54
\begin{tikzpicture}
\tikzstyle
{
prob
}
=[minimum width=0.4em, fill=blue!15,inner sep=0pt]
\node
[draw,fill=red!20,inner sep=0pt,minimum width=3em,minimum height=5em]
(key) at (0,0)
{}
;
\draw
[]
([yshift=0.5em]key.180) -- ([yshift=0.5em]key.0);
\draw
[]
([yshift=1.5em]key.180) -- ([yshift=1.5em]key.0);
\draw
[]
([yshift=-0.5em]key.180) -- ([yshift=-0.5em]key.0);
\draw
[]
([yshift=-1.5em]key.180) -- ([yshift=-1.5em]key.0);
\node
[draw,fill=blue!20,inner sep=0pt,minimum width=3em,minimum height=5em]
(value) at (3em,0)
{}
;
\draw
[]
([yshift=0.5em]value.180) -- ([yshift=0.5em]value.0);
\draw
[]
([yshift=1.5em]value.180) -- ([yshift=1.5em]value.0);
\draw
[]
([yshift=-0.5em]value.180) -- ([yshift=-0.5em]value.0);
\draw
[]
([yshift=-1.5em]value.180) -- ([yshift=-1.5em]value.0);
\node
[anchor=south,font=\footnotesize,inner sep=0pt]
at ([yshift=0.1em]key.north)
{
key
}
;
\node
[anchor=south,font=\footnotesize,inner sep=0pt]
at ([yshift=0.2em]value.north)
{
value
}
;
\node
[anchor=south,font=\footnotesize,inner sep=0pt]
(cache)at ([yshift=2em,xshift=1.5em]key.north)
{
\small\bfnew
{
Cache
}}
;
\node
[draw,anchor=east,minimum size=2.4em]
(dt) at ([yshift=1.4em,xshift=-4em]key.west)
{$
\mathbi
{
d
}_
\mathbi
{
t
}$}
;
\node
[draw,anchor=east,minimum size=2.4em]
(st) at ([xshift=-4em]dt.west)
{$
\mathbi
{
s
}_
\mathbi
{
t
}$}
;
\node
[draw,anchor=east,minimum size=2.4em]
(st2) at ([xshift=-0.8em,yshift=4em]dt.west)
{$
\widetilde
{
\mathbi
{
s
}}_
\mathbi
{
t
}$}
;
\node
[draw,anchor=north,circle,inner sep=0pt, minimum size=1.2em,fill=yellow]
(add) at ([yshift=-1em]st2.south)
{
+
}
;
\node
[anchor=north,inner sep=0pt,font=\footnotesize,text=red]
at ([yshift=-1em]add.south)
{
combining
}
;
\node
[draw,anchor=east,minimum size=2.4em]
(ct) at ([xshift=-3em,yshift=-3.5em]st.west)
{$
\widetilde
{
\mathbi
{
C
}}_
\mathbi
{
t
}$}
;
\node
[anchor=east]
(y) at ([xshift=-6em,yshift=1em]st.west)
{$
\mathbi
{
y
}_{
\mathbi
{
t
}
-
\mathbi
{
1
}}$}
;
\node
[draw,anchor=east,minimum width=8em,minimum height=1.6em,fill=blue!20]
(output) at ([xshift=-2.6em,yshift=2.6em]st2.west)
{}
;
\node
[anchor=south]
(yt) at ([yshift=5em]output.north)
{$
\mathbi
{
y
}_{
\mathbi
{
t
}}$}
;
\draw
[]
([xshift=-0.8em]output.90) -- ([xshift=-0.8em]output.-90);
\draw
[]
([xshift=-2.4em]output.90) -- ([xshift=-2.4em]output.-90);
\draw
[]
([xshift=0.8em]output.90) -- ([xshift=0.8em]output.-90);
\draw
[]
([xshift=2.4em]output.90) -- ([xshift=2.4em]output.-90);
\foreach
\x
/
\y
in
{
1/2,2/1,3/5,4/1,5/1,6/1,7/3,8/4,9/2,10/3,11/5,12/5,13/2,14/5,15/5,16/5,17/13,18/2,19/4,20/1
}
\node
[draw=blue!20,anchor=south,prob,minimum height=0.2em*\y]
at ([yshift=1em,xshift=-4.2em+0.4em*
\x
]output.north)
{}
;
\begin{pgfonlayer}
{
background
}
\node
[inner sep=3pt,draw,dotted,rounded corners=2pt,very thick][fit=(key)(value)(cache)]
(box)
{}
;
\end{pgfonlayer}
\draw
[-latex,dashed,very thick,out=-145,in=10]
([yshift=1.6em]box.180) to node[above,font=
\footnotesize
,text=red,rotate=25]
{
reading
}
(dt.0);
\draw
[-latex,dashed,very thick,out=-5,in=-170]
(ct.0) to node[above,font=
\footnotesize
,text=red,pos=0.7,rotate=8]
{
matching
}
([yshift=-2.5em]box.180);
\draw
[-,very thick,out=0,in=-135]
(st.0) to (add.-135);
\draw
[-,very thick,out=180,in=-45]
(dt.180) to (add.-45);
\draw
[-latex,very thick]
(add.90) -- (st2.-90);
\draw
[-latex,very thick,out=100,in=-100]
(ct.90) to (output.-90);
\draw
[-latex,very thick,out=180,in=-100]
(st2.180) to (output.-90);
\draw
[-latex,very thick,out=80,in=-100]
(y.90) to (output.-90);
\draw
[-latex,very thick]
(output.90) -- ([yshift=1em]output.90);
\draw
[-latex,very thick]
([yshift=-1em]yt.-90) -- (yt.-90);
\end{tikzpicture}
\ No newline at end of file
Chapter17/Figures/figure-layer.tex
0 → 100644
查看文件 @
4c6d9f54
\begin{tikzpicture}
\foreach
\x
in
{
1,2,3,4
}
\node
[inner sep=0pt,minimum size=1em,fill=ublue,circle]
(c1
_
\x
) at (0em+1.6em*
\x
, 0em)
{}
;
\foreach
\x
in
{
1,2,3,4,5,6
}
\node
[inner sep=0pt,minimum size=1em,fill=ublue,circle]
(c2
_
\x
) at (8.4em+1.6em*
\x
, 0em)
{}
;
\foreach
\x
in
{
1,2,3,4,5
}
\node
[inner sep=0pt,minimum size=1em,fill=ublue,circle]
(c3
_
\x
) at (20em+1.6em*
\x
, 0em)
{}
;
\foreach
\x
in
{
1,2,3,4,5
}
\node
[inner sep=0pt,minimum size=1em,fill=orange,circle]
(c4
_
\x
) at (20em+1.6em*
\x
, 9.4em)
{}
;
\node
[inner sep=0pt,minimum size=1em,fill=ugreen,circle]
(c5) at (9em, 7em)
{}
;
\node
[inner sep=0pt,minimum size=1.2em,fill=ugreen,circle]
(qs) at (18.6em, 5em)
{}
;
\node
[inner sep=0pt,minimum size=1.2em,fill=ugreen,circle]
(qw) at (18.6em, 3em)
{}
;
\node
[fill=orange,inner sep=0pt, minimum size=1.2em, circle, text=white]
(sigma) at (24.8em, 7em)
{
\small\bfnew
{$
\sigma
$}}
;
\node
[fill=ugreen,inner sep=0pt, minimum size=1.2em, circle, text=white]
(add1) at (4em, 3em)
{
\small\bfnew
{
+
}}
;
\node
[fill=ugreen,inner sep=0pt, minimum size=1.2em, circle, text=white]
(add2) at (14em, 3em)
{
\small\bfnew
{
+
}}
;
\node
[fill=ugreen,inner sep=0pt, minimum size=1.2em, circle, text=white]
(add3) at (9em, 5em)
{
\small\bfnew
{
+
}}
;
\begin{pgfonlayer}
{
background
}
\node
[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c1_1)(c1_4)]
(box1)
{}
;
\node
[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c2_1)(c2_6)]
(box2)
{}
;
\node
[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c3_1)(c3_5)]
(box3)
{}
;
\node
[draw,rounded corners=2pt,drop shadow,fill=white][fit=(c4_1)(c4_5)]
(box4)
{}
;
\node
[draw,rounded corners=2pt,inner xsep=6pt,drop shadow,fill=white][fit=(c5)]
(box5)
{}
;
\end{pgfonlayer}
\node
[draw,dash pattern=on 3pt off 1pt,minimum width=1.6em, minimum height=2em,very thick]
(n1) at (24.8em,0em)
{}
;
\node
[draw,dash pattern=on 3pt off 1pt,minimum width=1.6em, minimum height=2em,very thick]
(n2) at (24.8em,9.4em)
{}
;
\node
[]
at (24.8em, -1.5em)
{$
\mathbi
{
x
}_
\mathbi
{
t
}$}
;
\node
[text=ublue]
at (8.2em, 0em)
{
\small\bfnew
{
...
}}
;
\draw
[-latex, out=70, in=-120]
(c1
_
1.90) node[xshift=-0.4em,yshift=1.2em]
{$
\mathbi
{
h
}_
\mathbi
{
i
}^
\mathbi
{
j
}$}
to (add1.-90);
\draw
[-latex, out=80, in=-100]
(c1
_
2.90) to (add1.-90);
\draw
[-latex, out=100, in=-80]
(c1
_
3.90) to (add1.-90);
\draw
[-latex, out=110, in=-60]
(c1
_
4.90) to (add1.-90);
\draw
[-latex, out=60, in=-140]
(c2
_
1.90) to (add2.-90);
\draw
[-latex, out=70, in=-120]
(c2
_
2.90) to (add2.-90);
\draw
[-latex, out=80, in=-100]
(c2
_
3.90) to (add2.-90);
\draw
[-latex, out=100, in=-80]
(c2
_
4.90) to (add2.-90);
\draw
[-latex, out=110, in=-60]
(c2
_
5.90) to (add2.-90);
\draw
[-latex, out=120, in=-40]
(c2
_
6.90) to (add2.-90);
\draw
[-latex, out=20, in=-150]
(add1.90) node[xshift=-0.4em,yshift=1.2em]
{$
\mathbi
{
s
}^
\mathbi
{
j
}$}
to (add3.-90);
\draw
[-latex, out=160, in=-30]
(add2.90) to (add3.-90);
\draw
[-latex]
(add3.90) -- (box5.-90);
\draw
[-latex]
(box5.0) -- node[xshift=-3em,above]
{$
\mathbi
{
d
}_
\mathbi
{
t
}$}
(sigma.180);
\draw
[-latex, ugreen!60]
(qs.180) node[xshift=-1em,above,text=black]
{$
\mathbi
{
q
}_
\mathbi
{
s
}$}
-- (add3.0);
\draw
[-, ugreen!60]
(qw.180) node[xshift=-1em,above,text=black]
{$
\mathbi
{
q
}_
\mathbi
{
w
}$}
-- (add2.0);
\draw
[-latex, ugreen!60]
(add2.180) -- (add1.0);
\draw
[-latex]
(n1.130) -- (qw.0);
\draw
[-latex]
(n1.120) -- (qs.0);
\draw
[-latex]
(n1.90) node[yshift=1em,right]
{$
\mathbi
{
h
}_
\mathbi
{
t
}$}
-- (sigma.-90);
\draw
[-latex]
(sigma.90) -- (n2.-90);
\draw
[-latex]
(n2.90) -- node[right]
{$
\widetilde
{
\mathbi
{
h
}}_
\mathbi
{
t
}$}
([yshift=2em]n2.90);
\draw
[decorate,decoration={brace, mirror},gray, thick]
([yshift=-2em]box1.-180) -- node[font=
\scriptsize
,text=black,below]
{
前几句
}
([yshift=-2em]box2.0);
\draw
[decorate,decoration={brace, mirror},gray, thick]
([yshift=-2em]box3.-180) -- node[font=
\scriptsize
,text=black,below]
{
当前句
}
([yshift=-2em]box3.0);
%annotation
\node
[fill=ublue,rounded corners=1pt,inner sep=0pt,minimum size=1em]
(a1) at (2em,-4.5em)
{}
;
\node
[anchor=west,font=\footnotesize]
(w1) at ([xshift=0.4em]a1.east)
{
编码表示
}
;
\node
[anchor=west,fill=ugreen,rounded corners=1pt,inner sep=0pt,minimum size=1em]
(a2) at ([xshift=2em]w1.east)
{}
;
\node
[anchor=west,font=\footnotesize]
(w2)at ([xshift=0.4em]a2.east)
{
层次注意力
}
;
\node
[anchor=west,fill=orange,rounded corners=1pt,inner sep=0pt,minimum size=1em]
(a3) at ([xshift=2em]w2.east)
{}
;
\node
[anchor=west,font=\footnotesize]
at ([xshift=0.4em]a3.east)
{
融合上下文信息的编码表示
}
;
\end{tikzpicture}
Chapter17/Figures/figure-multiencoder.tex
查看文件 @
4c6d9f54
\definecolor
{
color1
}{
rgb
}{
1,0.725,0.058
}
\definecolor
{
color1
}{
rgb
}{
1,0.725,0.058
}
\tikzstyle
{
coder
}
= [rectangle,thick,rounded corners,minimum width=2.8cm,minimum height=1.1cm,text centered,draw=black!70,fill=blue!10]
\tikzstyle
{
coder
}
= [rectangle,thick,rounded corners,minimum width=2.8cm,minimum height=1.1cm,text centered,draw=black!70,fill=blue!10
,drop shadow
]
\tikzstyle
{
attention
}
= [rectangle,thick,rounded corners,minimum width=2.6cm,minimum height=0.9cm,text centered,draw=black!70,fill=green!25]
\tikzstyle
{
attention
}
= [rectangle,thick,rounded corners,minimum width=2.6cm,minimum height=0.9cm,text centered,draw=black!70,fill=green!25
,drop shadow
]
\begin{tikzpicture}
[node distance = 0,scale =
1
]
\begin{tikzpicture}
[node distance = 0,scale =
0.7
]
\tikzstyle
{
every node
}
=[scale=
1
]
\tikzstyle
{
every node
}
=[scale=
0.7
]
\node
(encoder
_
c)[coder]
{
\large
{
编码器
}}
;
\node
(encoder
_
c)[coder]
{
\large
{
编码器
}}
;
\node
(encoder
_
s)[coder, right of = encoder
_
c, xshift=3.5cm, fill=red!25]
{
\large
{
编码器
}}
;
\node
(encoder
_
s)[coder, right of = encoder
_
c, xshift=3.5cm, fill=red!25]
{
\large
{
编码器
}}
;
\node
(h
_
pre)[above of = encoder
_
c, yshift=1.3cm,scale=1.3]
{${
\mathbi
{
h
}}_{
pre
}$}
;
\node
(h
_
pre)[above of = encoder
_
c, yshift=1.3cm,scale=1.3]
{${
\mathbi
{
h
}}_{
pre
}$}
;
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
\node
(current)[below of = encoder
_
s, yshift=-1.3cm]
{
\large
{
当前句
}}
;
\node
(current)[below of = encoder
_
s, yshift=-1.3cm]
{
\large
{
当前句
}}
;
\node
(attention
_
left)[attention, above of = encoder
_
c, xshift=2.4cm,yshift=3.1cm]
{
\large
{
注意力机制
}}
;
\node
(attention
_
left)[attention, above of = encoder
_
c, xshift=2.4cm,yshift=3.1cm]
{
\large
{
注意力机制
}}
;
\node
(d)[above of = attention
_
left, yshift=1.1cm,scale=1.3]
{$
\mathbi
{
d
}$}
;
\node
(d)[above of = attention
_
left, yshift=1.1cm,scale=1.3]
{$
\mathbi
{
d
}$}
;
\node
(ground)[rectangle, thick, rounded corners, minimum width=5cm, minimum height=5.5cm, right of = encoder
_
s, xshift=4.4cm,yshift=2.2cm, draw=black!70, fill=gray!
3
0]
{}
;
\node
(ground)[rectangle, thick, rounded corners, minimum width=5cm, minimum height=5.5cm, right of = encoder
_
s, xshift=4.4cm,yshift=2.2cm, draw=black!70, fill=gray!
1
0]
{}
;
\node
(decoder)[above of = encoder
_
s, xshift=3.1cm]
{
\large
{
解码器
}}
;
\node
(decoder)[above of = encoder
_
s, xshift=3.1cm]
{
\large
{
解码器
}}
;
\node
(attention
_
right)[attention, right of = attention
_
left, xshift=5.4cm,yshift=-0.4cm]
{
\large
{
注意力机制
}}
;
\node
(attention
_
right)[attention, right of = attention
_
left, xshift=5.4cm,yshift=-0.4cm]
{
\large
{
注意力机制
}}
;
\node
(target)[right of = current, xshift=5.3cm]
{
\large
{
目标句
}}
;
\node
(target)[right of = current, xshift=5.3cm]
{
\large
{
目标句
}}
;
...
...
Chapter17/chapter17.tex
查看文件 @
4c6d9f54
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论