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
c63f0aad
Commit
c63f0aad
authored
Nov 09, 2020
by
zengxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11 and bib
parent
043f2b30
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
69 行增加
和
211 行删除
+69
-211
Chapter11/Figures/figure-fairseq-0.tex
+43
-22
Chapter11/Figures/figure-fairseq-1.tex
+0
-171
Chapter11/Figures/figure-fairseq-2.tex
+12
-8
Chapter11/Figures/figure-fairseq-3.tex
+13
-8
structure.tex
+1
-2
没有找到文件。
Chapter11/Figures/figure-fairseq-0.tex
查看文件 @
c63f0aad
%\documentclass[tikz]{standalone}
%\usepackage{tikz}
%\usepackage[UTF8]{ctex}
%\usetikzlibrary{shapes}
%\usetikzlibrary{backgrounds}
%\usetikzlibrary{shadows}
%\usepackage{bm}
%\usetikzlibrary{fit}
\definecolor
{
mc
_
1
_
m
}{
RGB
}{
228,236,255
}
\definecolor
{
mc
_
1
}{
RGB
}{
187,214,255
}
\definecolor
{
mc
_
2
_
m
}{
RGB
}{
255,251,217
}
...
...
@@ -6,6 +15,8 @@
\definecolor
{
mc
_
3
}{
RGB
}{
247,228,214
}
\definecolor
{
mc
_
4
_
m
}{
RGB
}{
240,241,254
}
\definecolor
{
mc
_
4
}{
RGB
}{
208,211,244
}
\definecolor
{
ugreen
}{
rgb
}{
0,0.5,0
}
\begin{tikzpicture}
[scale=0.8]
\tikzstyle
{
every node
}
=[scale=0.8]
\tikzstyle
{
rec
}
= [thick,fill=red!10,draw,drop shadow,minimum height =1em,minimum width=2em]
...
...
@@ -14,24 +25,33 @@
\begin{scope}
\foreach
\point
in
{
0,1,2,3,4,5
}
\node
[rec]
(i
_
\point
) at (
\point
, 0
)
{}
;
\node
[rec]
(i
_
\point
) at (
0.9+
\point
, -0.1
)
{}
;
\draw
[thick]
(i
_
0.0) -- (i
_
1.180);
\draw
[thick]
(i
_
1.0) -- (i
_
2.180);
\draw
[thick]
(i
_
2.0) -- (i
_
3.180);
\draw
[thick]
(i
_
3.0) -- (i
_
4.180);
\draw
[thick]
(i
_
4.0) -- (i
_
5.180);
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
(tgt
_
1)
at ([yshift=-0.4em]i
_
0.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{$
<
$
s
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{
go
}
;
\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]
(tgt
_
2) at ([yshift=-0.4em]i
_
5.south)
{
school
}
;
\begin{pgfonlayer}
{
background
}
\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}
\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
_
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
{
线性单元
}}
;
\foreach
\point
in
{
0,1,2
}
\draw
[thick,fill=blue!20]
(5
-
\point
,0.4) -- (5-
\point
,1.5) -- (3-
\point
,0.4) -- (5
-
\point
,0.4);
\draw
[thick,fill=blue!40]
(2
,0.4) -- (2,1.5) -- (0,0.4) -- (2
,0.4);
\draw
[thick,fill=blue!20]
(5
.9-
\point
,0.4) -- (4.9-
\point
,1.5) -- (3.9-
\point
,0.4) -- (5.9
-
\point
,0.4);
\draw
[thick,fill=blue!40]
(2
.9,0.4) -- (1.9,1.5) -- (0.9,0.4) -- (2.9
,0.4);
\foreach
\point
in
{
0,1,2,3
}{
\node
[rec]
(h
_
\point
) at (1.9+
\point
, 1.6)
{}
;
...
...
@@ -66,7 +86,7 @@
\node
[rec,fill=blue!40]
(g
_
\point
_
3) at (5cm+
\point*
2em, 7.5cm-3em)
{}
;
}
\node
[anchor=north, word]
at ([yshift=-0.6em]g
_
1
_
3.south)
{
\
textbf
{
Dot products
}}
;
\node
[anchor=north, word]
at ([yshift=-0.6em]g
_
1
_
3.south)
{
\
sffamily\bfnew
{
内积
}}
;
\draw
[-latex, rounded corners=3pt,thick] (q
_
0.90) -- (2.5cm, 7.5cm) -- (g
_
0
_
0.180);
\draw
[-latex, rounded corners=3pt,thick] (q
_
1.90) -- (2.5cm+2em, 7.5cm-1em) -- (g
_
0
_
1.180);
...
...
@@ -78,7 +98,7 @@
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
2
_
3) at (5cm+4em, 7.5cm-3em)
{}
;
\foreach
\point
in
{
0,1,2,3
}
\node
[rec]
(i
_
\point
) at (8+
\point
,
0
)
{}
;
\node
[rec]
(i
_
\point
) at (8+
\point
,
-0.1
)
{}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{
go
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{
to
}
;
...
...
@@ -114,7 +134,7 @@
\draw
[-latex,out=-90,in=45,thick]
(c
_
\point
.-90) to (x
_
\point
.45);
\draw
[-latex,thick]
(x
_
\point
.-45) -- (h
_
\point
.90);
\draw
[-latex,thick]
(h
_
\point
.-90) -- (g
_
\point
_
0.90);
\node
[rec]
(r
_
\point
) at (4.7cm+
\point*
1cm, 12.5cm)
{}
;
\node
[rec]
(r
_
\point
) at (4.7cm+
\point*
1cm, 12.5
5
cm)
{}
;
}
\node
[anchor=south,word]
(src
_
1) at ([xshift=-2em,yshift=0.4em]r
_
0.north)
{$
<
$
p
$
>
$}
;
...
...
@@ -124,12 +144,12 @@
\node
[anchor=south,word]
(src
_
2) at ([xshift=2em,yshift=0.4em]r
_
2.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=east, word]
(t
_
1) at ([xshift=-
3em]r
_
0.west)
{
\textbf
{
Embeddings
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-
1em]t
_
1.south)
{
\textbf
{
Convolutions
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2
em]t
_
2.south)
{
\textbf
{
Gated
}}
;
\node
[anchor=north, word]
(t
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\
textbf
{
Linear
}}
;
\node
[anchor=north, word]
(t
_
5) at ([yshift=
-0.06em]t
_
4.south)
{
\textbf
{
Units
}}
;
\node
[anchor=north, word]
(t
_
6) at ([yshift=-
3.2em]t
_
5.south)
{
\textbf
{
Attention
}}
;
\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
_
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
_
5) at ([yshift=
1.24em]t
_
4.south)
{
\sffamily\bfnew
{
}}
;
\node
[anchor=north, word]
(t
_
6) at ([yshift=-
1.5em]t
_
5.south)
{
\sffamily\bfnew
{
注意力模块
}}
;
\node
[cir]
(o
_
2) at (7.95, 8.8cm)
{}
;
\draw
[line width=0.6pt]
(o
_
2.90) -- (o
_
2.-90);
...
...
@@ -139,7 +159,7 @@
\draw
[thick]
(r
_
0.0) -- (r
_
1.180);
\draw
[thick]
(r
_
1.0) -- (r
_
2.180);
\draw
[rounded corners=3pt,thick]
(r
_
2.0) -- (8.6cm+2em, 12.5cm) -- (o
_
3.90);
\draw
[rounded corners=3pt,thick]
(r
_
2.0) -- (8.6cm+2em, 12.5
5
cm) -- (o
_
3.90);
\draw
[-latex,thick]
(o
_
3.90) -- (o
_
3.-135) -- (w
_
0.90);
\draw
[-latex,thick]
(o
_
3.90) -- (o
_
3.-90) -- (w
_
1.90);
\draw
[-latex,thick]
(o
_
3.90) -- (o
_
3.-45) -- (w
_
2.90);
...
...
@@ -147,12 +167,13 @@
\node
[single arrow,minimum height=2.4em,fill=blue!30,minimum width=4pt,rotate=-90,draw, fill=blue!20] at (8.6cm+2em, 8cm)
{}
;
\begin{pgfonlayer}
{
background
}
\draw
[line width=2pt,draw=mc
_
1,fill=mc
_
1
_
m,rounded corners=4pt] ([yshift=0em,xshift=5em]t
_
6.north west) -- ([yshift=0em,xshift=6.1cm]t
_
6.north west) -- ([yshift=2.2cm,xshift=6.1cm]t
_
6.north west) -- ([yshift=2.2cm,xshift=9.4cm]t
_
6.north west) -- ([yshift=-4.8cm,xshift=9.4cm]t
_
6.north west) -- ([yshift=-4.8cm,xshift=-1em]t
_
6.north west)-- ([yshift=0em,xshift=-1em]t
_
6.north west) -- ([yshift=0em,xshift=5em]t
_
6.north west)
;
\node
[draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.2em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (src
_
1) (src
_
2)(r
_
2) ] (group1
)
{}
;
\draw
[line width=2pt,draw=mc_2,rounded corners=4pt,fill=mc_2_m]
(4.2cm, 12.1cm) -- (7.6cm,12.1cm) -- (7.6cm,8.45cm) -- (3.8cm,8.45cm) -- (3.8cm, 12.1cm) -- (4.2cm, 12.1cm)
;
\draw
[draw=white,fill=mc_2_m]
(1.3cm, 3.3cm) -- (5.4cm,3.3cm) -- (5.4cm,1.3cm) -- (1.3cm,1.3cm) -- (1.3cm, 3.3cm
);
\node
[draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.3em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (src
_
1) (src
_
2)(r
_
2) ] (group1
_
1)
{}
;
\node
[rectangle,rounded corners=4pt,fill=mc
_
2
_
m, minimum width=3.8cm, minimum height=2.8cm] (group2) at (5.7cm, 10.7cm
)
{}
;
\node
[rectangle,rounded corners=4pt,fill=mc
_
2
_
m, minimum width=5.2cm, minimum height=3.1cm] (group3) at (3.4cm, 1.85cm)
{}
;
\draw
[line width=2pt,draw=mc
_
1,fill=mc
_
1
_
m,rounded corners=4pt] ([yshift=0.4em,xshift=6em]t
_
6.north west) -- ([yshift=0.4em,xshift=6.3cm]t
_
6.north west) -- ([yshift=2.2cm,xshift=6.3cm]t
_
6.north west) -- ([yshift=2.2cm,xshift=9.8cm]t
_
6.north west) -- ([yshift=-5.4cm,xshift=9.8cm]t
_
6.north west) -- ([yshift=-5.4cm,xshift=-1.6em]t
_
6.north west)-- ([yshift=0.4em,xshift=-1.6em]t
_
6.north west) -- ([yshift=0.4em,xshift=6em]t
_
6.north west
);
\end{pgfonlayer}
\draw
[line width=2pt,draw=mc_2!180,rounded corners=4pt]
(1.6cm, 3.3cm) -- (5.4cm,3.3cm) -- (5.4cm,1.3cm) -- (1.3cm,1.3cm) -- (1.3cm, 3.3cm) -- (1.6cm, 3.3cm);
\node
[draw=mc
_
2!140,rectangle,rounded corners=4pt,line width=2pt,minimum width=3.8cm, minimum height=2.8cm] at (5.7cm, 10.7cm)
{}
;
\node
[draw=mc
_
2!140,rectangle,rounded corners=4pt,line width=2pt,minimum width=5.2cm, minimum height=3.1cm] at (3.4cm, 1.85cm)
{}
;
\end{scope}
\end{tikzpicture}
\ No newline at end of file
\end{tikzpicture}
\ No newline at end of file
Chapter11/Figures/figure-fairseq-1.tex
deleted
100644 → 0
查看文件 @
043f2b30
%\documentclass[tikz]{standalone}
%\usepackage{tikz}
%\usepackage[UTF8]{ctex}
%\usetikzlibrary{shapes}
%\usetikzlibrary{backgrounds}
%\usetikzlibrary{shadows}
%\usepackage{bm}
%\usetikzlibrary{fit}
\definecolor
{
mc
_
1
_
m
}{
RGB
}{
228,236,255
}
\definecolor
{
mc
_
1
}{
RGB
}{
187,214,255
}
\definecolor
{
mc
_
2
_
m
}{
RGB
}{
255,251,217
}
\definecolor
{
mc
_
2
}{
RGB
}{
232,232,198
}
\definecolor
{
mc
_
3
_
m
}{
RGB
}{
255,247,242
}
\definecolor
{
mc
_
3
}{
RGB
}{
247,228,214
}
\definecolor
{
mc
_
4
_
m
}{
RGB
}{
240,241,254
}
\definecolor
{
mc
_
4
}{
RGB
}{
208,211,244
}
\definecolor
{
ugreen
}{
rgb
}{
0,0.5,0
}
\begin{tikzpicture}
[scale=0.8]
\tikzstyle
{
every node
}
=[scale=0.8]
\tikzstyle
{
rec
}
= [thick,fill=red!10,draw,drop shadow,minimum height =1em,minimum width=2em]
\tikzstyle
{
cir
}
= [line width=0.6pt,fill=yellow!20,draw,circle,minimum size =0.5em,drop shadow=
{
shadow xshift=0.15em, shadow yshift=-0.1em
}
]
\tikzstyle
{
word
}
= [inner sep=0pt, font=
\footnotesize
, minimum height=1em,align=center]
\begin{scope}
\foreach
\point
in
{
0,1,2,3,4,5
}
\node
[rec]
(i
_
\point
) at (0.9+
\point
, -0.05)
{}
;
\draw
[thick]
(i
_
0.0) -- (i
_
1.180);
\draw
[thick]
(i
_
1.0) -- (i
_
2.180);
\draw
[thick]
(i
_
2.0) -- (i
_
3.180);
\draw
[thick]
(i
_
3.0) -- (i
_
4.180);
\draw
[thick]
(i
_
4.0) -- (i
_
5.180);
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{$
<
$
sos
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{
go
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
4.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
5.south)
{
school
}
;
\foreach
\point
in
{
0,1,2
}
\draw
[thick,fill=blue!20]
(5.9-
\point
,0.4) -- (4.9-
\point
,1.5) -- (3.9-
\point
,0.4) -- (5.9-
\point
,0.4);
\draw
[thick,fill=blue!40]
(2.9,0.4) -- (1.9,1.5) -- (0.9,0.4) -- (2.9,0.4);
\foreach
\point
in
{
0,1,2,3
}{
\node
[rec]
(h
_
\point
) at (1.9+
\point
, 1.6)
{}
;
\draw
[thick]
(h
_
\point
.90) -- (h
_
\point
.-90);
}
\foreach
\point
in
{
0,1,2,3
}{
\node
[cir]
(c
_
\point
) at (1.7+
\point
, 2.4)
{}
;
\draw
[out=20,in=160,line width=0.6pt]
(c
_
\point
.-135) to (c
_
\point
.45);
\node
[cir]
(x
_
\point
) at (2.1+
\point
, 3)
{}
;
\draw
[line width=0.6pt]
(x
_
\point
.-135) -- (x
_
\point
.45);
\draw
[line width=0.6pt]
(x
_
\point
.-45) -- (x
_
\point
.135);
\draw
[-latex,thick]
([xshift=-0.5em]h
_
\point
.90) -- (c
_
\point
.-90);
\draw
[-latex,thick]
([xshift=0.5em]h
_
\point
.90) -- (x
_
\point
.-90);
\draw
[-latex,out=90,in=-145,thick]
(c
_
\point
.90) to (x
_
\point
.-145);
}
\foreach
\point
in
{
0,1,2,3
}{
\node
[rec]
(q
_
\point
) at (2.5cm+
\point*
2em, 4)
{}
;
\draw
[-latex,thick]
(x
_
\point
.90) -- (q
_
\point
.-90);
}
\node
[cir]
(o
_
1) at (7.55cm, 4)
{}
;
\draw
[line width=0.6pt]
(o
_
1.90) -- (o
_
1.-90);
\draw
[line width=0.6pt]
(o
_
1.0) -- (o
_
1.180);
\draw
[-latex,thick]
(q
_
3.0) -- (o
_
1.180);
\foreach
\point
in
{
0,1,2
}{
\node
[rec,fill=blue!40]
(g
_
\point
_
0) at (5cm+
\point*
2em, 7.5cm)
{}
;
\node
[rec,fill=blue!40]
(g
_
\point
_
1) at (5cm+
\point*
2em, 7.5cm-1em)
{}
;
\node
[rec,fill=blue!40]
(g
_
\point
_
2) at (5cm+
\point*
2em, 7.5cm-2em)
{}
;
\node
[rec,fill=blue!40]
(g
_
\point
_
3) at (5cm+
\point*
2em, 7.5cm-3em)
{}
;
}
\node
[anchor=north, word]
at ([yshift=-0.6em]g
_
1
_
3.south)
{
\sffamily\bfnew
{
内积
}}
;
\draw
[-latex, rounded corners=3pt,thick] (q
_
0.90) -- (2.5cm, 7.5cm) -- (g
_
0
_
0.180);
\draw
[-latex, rounded corners=3pt,thick] (q
_
1.90) -- (2.5cm+2em, 7.5cm-1em) -- (g
_
0
_
1.180);
\draw
[-latex, rounded corners=3pt,thick] (q
_
2.90) -- (2.5cm+4em, 7.5cm-2em) -- (g
_
0
_
2.180);
\draw
[-latex, rounded corners=3pt,thick] (q
_
3.90) -- (2.5cm+6em, 6.2cm-2em) -- (2cm+6em, 6.2cm-2em) -- (2cm+6em, 7.5cm-3em) -- (g
_
0
_
3.180);
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
0
_
0) at (5cm, 7.5cm)
{}
;
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
1
_
1) at (5cm+2em, 7.5cm-1em)
{}
;
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
1
_
2) at (5cm+2em, 7.5cm-2em)
{}
;
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
2
_
3) at (5cm+4em, 7.5cm-3em)
{}
;
\foreach
\point
in
{
0,1,2,3
}
\node
[rec]
(i
_
\point
) at (8+
\point
, -0.05)
{}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{
go
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{
school
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{$
<
$
eos
$
>
$}
;
\foreach
\point
in
{
0,1,2,3
}{
\node
[cir,font=\fontsize{6}{6}\selectfont,inner sep=0.8pt]
(c
_
\point
) at (8.2cm+
\point*
2em,7.5cm-1em*
\point
)
{
\bm
{$
\sum
$}}
;
\node
[rec]
(q
_
\point
) at (8.2cm+
\point*
2em, 5)
{}
;
\node
[rec]
(b
_
\point
) at (8.2cm+
\point*
2em, 4)
{}
;
\draw
[-latex,thick]
(g
_
2
_
\point
.0) -- (c
_
\point
.180);
\draw
[-latex,thick]
(c
_
\point
.-90) -- (q
_
\point
.90);
\draw
[-latex,thick]
(q
_
\point
.-90) -- (b
_
\point
.90);
\draw
[-latex,thick]
(b
_
\point
.-90) -- ([yshift=-3.5cm]b
_
\point
.-90);
}
\foreach
\point
in
{
2,1
}
\draw
[thick,fill=blue!20]
(4.7cm+
\point*
1cm, 11cm) -- (3.9cm+
\point*
1cm, 12cm) -- (5.5cm+
\point*
1cm, 12cm) -- (4.7cm+
\point*
1cm, 11cm);
\draw
[thick,fill=blue!40]
(4.7cm,11cm) -- (3.9cm,12cm) -- (5.5cm,12cm) -- (4.7cm,11cm);
\foreach
\point
in
{
0,1,2
}{
\node
[rec]
(h
_
\point
) at (5cm+
\point*
2em, 8.8cm)
{}
;
\node
[rec]
(w
_
\point
) at (8.6cm+
\point*
2em, 8.8cm)
{}
;
\node
[cir]
(x
_
\point
) at (4.5cm+
\point*
1cm, 9.6cm)
{}
;
\draw
[line width=0.6pt]
(x
_
\point
.-135) -- (x
_
\point
.45);
\draw
[line width=0.6pt]
(x
_
\point
.-45) -- (x
_
\point
.135);
\node
[cir]
(c
_
\point
) at (4.9cm+
\point*
1cm, 10.2cm)
{}
;
\draw
[line width=0.6pt,out=20,in=160]
(c
_
\point
.-135) to (c
_
\point
.45);
\node
[rec]
(f
_
\point
) at (4.7cm+
\point*
1cm, 11cm)
{}
;
\draw
[-,thick]
(f
_
\point
.90) -- (f
_
\point
.-90);
\draw
[-latex,thick]
([xshift=-0.5em]f
_
\point
.-90) -- (x
_
\point
.90);
\draw
[-latex,thick]
([xshift=0.5em]f
_
\point
.-90) -- (c
_
\point
.90);
\draw
[-latex,out=-90,in=45,thick]
(c
_
\point
.-90) to (x
_
\point
.45);
\draw
[-latex,thick]
(x
_
\point
.-45) -- (h
_
\point
.90);
\draw
[-latex,thick]
(h
_
\point
.-90) -- (g
_
\point
_
0.90);
\node
[rec]
(r
_
\point
) at (4.7cm+
\point*
1cm, 12.55cm)
{}
;
}
\node
[anchor=south,word]
(src
_
1) at ([xshift=-2em,yshift=0.4em]r
_
0.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
0.north)
{
去
}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
1.north)
{
上学
}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
2.north)
{$
<
$
sos
$
>
$}
;
\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=north, word]
(t
_
2) at ([yshift=-1em,yshift=-1em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2em,yshift=-0.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
_
5) at ([yshift=-0.06em,yshift=1.3em]t
_
4.south)
{
\sffamily\bfnew
{}}
;
\node
[anchor=north, word]
(t
_
6) at ([yshift=-1.5em]t
_
5.south)
{
\sffamily\bfnew
{
注意力模块
}}
;
\node
[cir]
(o
_
2) at (7.95, 8.8cm)
{}
;
\draw
[line width=0.6pt]
(o
_
2.90) -- (o
_
2.-90);
\draw
[line width=0.6pt]
(o
_
2.0) -- (o
_
2.180);
\draw
[-latex,thick]
(h
_
2.0) -- (o
_
2.180);
\node
[cir]
(o
_
3) at (8.6cm+2em, 10cm)
{}
;
\draw
[thick]
(r
_
0.0) -- (r
_
1.180);
\draw
[thick]
(r
_
1.0) -- (r
_
2.180);
\draw
[rounded corners=3pt,thick]
(r
_
2.0) -- (8.6cm+2em, 12.55cm) -- (o
_
3.90);
\draw
[-latex,thick]
(o
_
3.90) -- (o
_
3.-135) -- (w
_
0.90);
\draw
[-latex,thick]
(o
_
3.90) -- (o
_
3.-90) -- (w
_
1.90);
\draw
[-latex,thick]
(o
_
3.90) -- (o
_
3.-45) -- (w
_
2.90);
\node
[single arrow,minimum height=2.4em,fill=blue!30,minimum width=4pt,rotate=-90,draw, fill=blue!20] at (8.6cm+2em, 8cm)
{}
;
\begin{pgfonlayer}
{
background
}
\node
[draw=ugreen!30,rectangle,inner ysep=5pt,inner xsep=1.3em,rounded corners=4pt,line width=2pt,fill=ugreen!10] [fit = (src
_
1) (src
_
2)(r
_
2) ] (group1)
{}
;
%\node [rectangle,rounded corners=4pt,fill=mc_2_m, minimum width=3.8cm, minimum height=2.8cm] (group2) at (5.7cm, 10.7cm) {};
%\node [rectangle,rounded corners=4pt,fill=mc_2_m, minimum width=5.2cm, minimum height=3.1cm] (group3) at (3.4cm, 1.85cm) {};
%\draw [line width=2pt,draw=mc_1,fill=mc_1_m,rounded corners=4pt] ([yshift=0.4em,xshift=6em]t_6.north west) -- ([yshift=0.4em,xshift=6.3cm]t_6.north west) -- ([yshift=2.2cm,xshift=6.3cm]t_6.north west) -- ([yshift=2.2cm,xshift=9.8cm]t_6.north west) -- ([yshift=-5.4cm,xshift=9.8cm]t_6.north west) -- ([yshift=-5.4cm,xshift=-1.6em]t_6.north west)-- ([yshift=0.4em,xshift=-1.6em]t_6.north west) -- ([yshift=0.4em,xshift=6em]t_6.north west);
\end{pgfonlayer}
%\node [draw=mc_2!140,rectangle,rounded corners=4pt,line width=2pt,minimum width=3.8cm, minimum height=2.8cm] at (5.7cm, 10.7cm) {};
%\node [draw=mc_2!140,rectangle,rounded corners=4pt,line width=2pt,minimum width=5.2cm, minimum height=3.1cm] at (3.4cm, 1.85cm) {};
\end{scope}
\end{tikzpicture}
\ No newline at end of file
Chapter11/Figures/figure-fairseq-2.tex
查看文件 @
c63f0aad
...
...
@@ -25,7 +25,7 @@
\begin{scope}
\foreach
\point
in
{
0,1,2,3,4,5
}
\node
[rec]
(i
_
\point
) at (0.9+
\point
, -0.
05
)
{}
;
\node
[rec]
(i
_
\point
) at (0.9+
\point
, -0.
1
)
{}
;
\draw
[thick]
(i
_
0.0) -- (i
_
1.180);
\draw
[thick]
(i
_
1.0) -- (i
_
2.180);
\draw
[thick]
(i
_
2.0) -- (i
_
3.180);
...
...
@@ -34,11 +34,15 @@
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{$
<
$
s
os
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{$
<
$
s
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{
go
}
;
\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=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
_
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
{
线性单元
}}
;
\foreach
\point
in
{
0,1,2
}
\draw
[thick,fill=blue!20]
(5.9-
\point
,0.4) -- (4.9-
\point
,1.5) -- (3.9-
\point
,0.4) -- (5.9-
\point
,0.4);
...
...
@@ -89,12 +93,12 @@
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
2
_
3) at (5cm+4em, 7.5cm-3em)
{}
;
\foreach
\point
in
{
0,1,2,3
}
\node
[rec]
(i
_
\point
) at (8+
\point
, -0.
05
)
{}
;
\node
[rec]
(i
_
\point
) at (8+
\point
, -0.
1
)
{}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{
go
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{
school
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{$
<
$
eo
s
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{$
<
$
/
s
$
>
$}
;
\foreach
\point
in
{
0,1,2,3
}{
\node
[cir,font=\fontsize{6}{6}\selectfont,inner sep=0.8pt]
(c
_
\point
) at (8.2cm+
\point*
2em,7.5cm-1em*
\point
)
{
\bm
{$
\sum
$}}
;
...
...
@@ -131,15 +135,15 @@
\node
[anchor=south,word]
(src
_
1) at ([xshift=-2em,yshift=0.4em]r
_
0.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
0.north)
{
去
}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
1.north)
{
上学
}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
2.north)
{$
<
$
s
os
$
>
$}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
2.north)
{$
<
$
s
$
>
$}
;
\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=north, word]
(t
_
2) at ([yshift=-
1em,yshift=-1
em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2
em,yshift=-0
.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-
2
em]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
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=north, word]
(t
_
5) at ([yshift=
-0.06em,yshift=1.3
em]t
_
4.south)
{
\sffamily\bfnew
{}}
;
\node
[anchor=north, word]
(t
_
5) at ([yshift=
1.24
em]t
_
4.south)
{
\sffamily\bfnew
{}}
;
\node
[anchor=north, word]
(t
_
6) at ([yshift=-1.5em]t
_
5.south)
{
\sffamily\bfnew
{
注意力模块
}}
;
\node
[cir]
(o
_
2) at (7.95, 8.8cm)
{}
;
...
...
Chapter11/Figures/figure-fairseq-3.tex
查看文件 @
c63f0aad
...
...
@@ -25,7 +25,7 @@
\begin{scope}
\foreach
\point
in
{
0,1,2,3,4,5
}
\node
[rec]
(i
_
\point
) at (0.9+
\point
, -0.
05
)
{}
;
\node
[rec]
(i
_
\point
) at (0.9+
\point
, -0.
1
)
{}
;
\draw
[thick]
(i
_
0.0) -- (i
_
1.180);
\draw
[thick]
(i
_
1.0) -- (i
_
2.180);
\draw
[thick]
(i
_
2.0) -- (i
_
3.180);
...
...
@@ -34,11 +34,16 @@
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{$
<
$
p
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{$
<
$
s
os
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{$
<
$
s
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{
go
}
;
\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=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
_
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
{
线性单元
}}
;
\foreach
\point
in
{
0,1,2
}
\draw
[thick,fill=blue!20]
(5.9-
\point
,0.4) -- (4.9-
\point
,1.5) -- (3.9-
\point
,0.4) -- (5.9-
\point
,0.4);
...
...
@@ -89,12 +94,12 @@
\node
[thick,draw,fill=yellow!60,minimum height =1em,minimum width=2em]
(g
_
2
_
3) at (5cm+4em, 7.5cm-3em)
{}
;
\foreach
\point
in
{
0,1,2,3
}
\node
[rec]
(i
_
\point
) at (8+
\point
, -0.
05
)
{}
;
\node
[rec]
(i
_
\point
) at (8+
\point
, -0.
1
)
{}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
0.south)
{
go
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
1.south)
{
to
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
2.south)
{
school
}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{$
<
$
eo
s
$
>
$}
;
\node
[anchor=north,word]
at ([yshift=-0.4em]i
_
3.south)
{$
<
$
/
s
$
>
$}
;
\foreach
\point
in
{
0,1,2,3
}{
\node
[cir,font=\fontsize{6}{6}\selectfont,inner sep=0.8pt]
(c
_
\point
) at (8.2cm+
\point*
2em,7.5cm-1em*
\point
)
{
\bm
{$
\sum
$}}
;
...
...
@@ -131,15 +136,15 @@
\node
[anchor=south,word]
(src
_
1) at ([xshift=-2em,yshift=0.4em]r
_
0.north)
{$
<
$
p
$
>
$}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
0.north)
{
去
}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
1.north)
{
上学
}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
2.north)
{$
<
$
s
os
$
>
$}
;
\node
[anchor=south,word]
at ([yshift=0.4em]r
_
2.north)
{$
<
$
s
$
>
$}
;
\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=north, word]
(t
_
2) at ([yshift=-
1em,yshift=-1
em]t
_
1.south)
{
\sffamily\bfnew
{
卷积
}}
;
\node
[anchor=north, word]
(t
_
3) at ([yshift=-2
em,yshift=-0
.8em]t
_
2.south)
{
\sffamily\bfnew
{
门控
}}
;
\node
[anchor=north, word]
(t
_
2) at ([yshift=-
2
em]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
_
4) at ([yshift=-0.06em]t
_
3.south)
{
\sffamily\bfnew
{
线性单元
}}
;
\node
[anchor=north, word]
(t
_
5) at ([yshift=
-0.06em,yshift=1.3
em]t
_
4.south)
{
\sffamily\bfnew
{}}
;
\node
[anchor=north, word]
(t
_
5) at ([yshift=
1.24
em]t
_
4.south)
{
\sffamily\bfnew
{}}
;
\node
[anchor=north, word]
(t
_
6) at ([yshift=-1.5em]t
_
5.south)
{
\sffamily\bfnew
{
注意力模块
}}
;
\node
[cir]
(o
_
2) at (7.95, 8.8cm)
{}
;
...
...
structure.tex
查看文件 @
c63f0aad
...
...
@@ -666,8 +666,7 @@ addtohook={%
\usepackage
[mathscr]
{
euscript
}
%%%%%%%%%%%chapter 11---------------------------------------
\newlength
{
\bc
}
\setlength
{
\bc
}{
0.4cm
}
\newcommand
{
\mychapter
}
[1]
{
第
\ref
{
#1
}
章
}
%chapter用
\newcommand
{
\mysection
}
[1]
{
第
\ref
{
#1
}
节
}
%section、subsection、subsubsection用
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论