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
071ff6c5
Commit
071ff6c5
authored
May 14, 2020
by
孟霞
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'mengxia' 到 'caorunzhe'
Mengxia 查看合并请求
!186
parents
1b087c3f
a859a175
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
109 行增加
和
113 行删除
+109
-113
Book/Chapter5/Figures/fig-code-niutensor-one.tex
+40
-0
Book/Chapter5/Figures/fig-code-niutensor-three.tex
+0
-40
Book/Chapter5/Figures/fig-code-tensor-define-2.tex
+28
-0
Book/Chapter5/Figures/fig-code-tensor-define-3.tex
+0
-15
Book/Chapter5/Figures/fig-code-tensor-define-GPU.tex
+0
-14
Book/Chapter5/Figures/fig-code-tensor-mul.tex
+0
-17
Book/Chapter5/Figures/fig-code-tensor-operation.tex
+17
-0
Book/Chapter5/Figures/fig-rnn-model.tex
+3
-5
Book/Chapter5/Figures/fig-sawtooth.tex
+1
-1
Book/Chapter5/Figures/fig-transformer-LM.tex
+18
-19
Book/Chapter5/Figures/fig-weather.tex
+2
-2
Book/Chapter5/chapter5.tex
+0
-0
没有找到文件。
Book/Chapter5/Figures/fig-code-niutensor-one.tex
查看文件 @
071ff6c5
...
@@ -25,5 +25,45 @@
...
@@ -25,5 +25,45 @@
\end{tikzpicture}
\end{tikzpicture}
\end{center}
\end{center}
\end{tcolorbox}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(a) 构建单层神经网络
}
\\
\begin{tcolorbox}
[bicolor,sidebyside,width=11cm,righthand width=4cm,size=title,frame engine=empty,
colback=blue!10!white,colbacklower=black!5!white]
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor x, y, h1, h2;
}
\\
\texttt
{
XTensor w1, b1, w2, w3;
}
\\
\texttt
{
InitTensor3D(
\&
x, 3, 4, 5);
}
\\
\texttt
{
InitTensor2D(
\&
w1, 5, 3);
}
\\
\texttt
{
InitTensor1D(
\&
b1, 3);
}
\\
\texttt
{
InitTensor2D(
\&
w2, 3, 6);
}
\\
\texttt
{
InitTensor2D(
\&
w3, 6, 4);
}
\\
\texttt
{
...
}
\\
\texttt
{
h1 = Sigmoid(MMul(x, w1) + b1);
}
\\
\texttt
{
h2 = HandTanH(MMul(h1, w2));
}
\\
\texttt
{
y = Relu(MMul(h2, w3));
}
\end{tabbing}
}
\tcblower
\begin{center}
\begin{tikzpicture}
\node
[draw,circle,inner sep=2pt,fill=red!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (x) at (0,0)
{
\footnotesize
{$
\textrm
{
x
}$}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=4em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (layer1) at ([yshift=0.7em]x.north)
{
\scriptsize
{
layer1
}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=4em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (layer2) at ([yshift=1.0em]layer1.north)
{
\scriptsize
{
layer2
}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=4em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (layer3) at ([yshift=1.0em]layer2.north)
{
\scriptsize
{
layer3
}}
;
\node
[anchor=south,draw,circle,inner sep=2pt,fill=red!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (y) at ([yshift=0.7em]layer3.north)
{
\scriptsize
{$
\textrm
{
y
}$}}
;
\draw
[thick,->] (x.north) -- (layer1.south);
\draw
[thick,->] (layer1.north) -- (layer2.south);
\draw
[thick,->] (layer2.north) -- (layer3.south);
\draw
[thick,->] (layer3.north) -- (y.south);
\node
[anchor=west,align=left] (xshape) at (x.east)
{
\tiny
{
shape: 3*4*5
}}
;
\node
[anchor=west,align=left] (yshape) at (y.east)
{
\tiny
{
shape: 3*4*4
}}
;
\node
[anchor=south west,align=left,inner sep=2pt] (l1shape) at (layer1.north)
{
\tiny
{
shape: 3*4*3
}}
;
\node
[anchor=south west,align=left,inner sep=2pt] (l2shape) at (layer2.north)
{
\tiny
{
shape: 3*4*6
}}
;
\end{tikzpicture}
\end{center}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(b) 构建三层神经网络
}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-code-niutensor-three.tex
deleted
100644 → 0
查看文件 @
1b087c3f
%%%------------------------------------------------------------------------------------------------------------
\begin{tcolorbox}
[bicolor,sidebyside,width=11cm,righthand width=4cm,size=title,frame engine=empty,
colback=blue!10!white,colbacklower=black!5!white]
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor x, y, h1, h2;
}
\\
\texttt
{
XTensor w1, b1, w2, w3;
}
\\
\texttt
{
InitTensor3D(
\&
x, 3, 4, 5);
}
\\
\texttt
{
InitTensor2D(
\&
w1, 5, 3);
}
\\
\texttt
{
InitTensor1D(
\&
b1, 3);
}
\\
\texttt
{
InitTensor2D(
\&
w2, 3, 6);
}
\\
\texttt
{
InitTensor2D(
\&
w3, 6, 4);
}
\\
\texttt
{
...
}
\\
\texttt
{
h1 = Sigmoid(MMul(x, w1) + b1);
}
\\
\texttt
{
h2 = HandTanH(MMul(h1, w2));
}
\\
\texttt
{
y = Relu(MMul(h2, w3));
}
\end{tabbing}
}
\tcblower
\begin{center}
\begin{tikzpicture}
\node
[draw,circle,inner sep=2pt,fill=red!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (x) at (0,0)
{
\footnotesize
{$
\textrm
{
x
}$}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=4em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (layer1) at ([yshift=0.7em]x.north)
{
\scriptsize
{
layer1
}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=4em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (layer2) at ([yshift=1.0em]layer1.north)
{
\scriptsize
{
layer2
}}
;
\node
[anchor=south,draw,rounded corners,inner sep=2pt,minimum width=4em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (layer3) at ([yshift=1.0em]layer2.north)
{
\scriptsize
{
layer3
}}
;
\node
[anchor=south,draw,circle,inner sep=2pt,fill=red!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
] (y) at ([yshift=0.7em]layer3.north)
{
\scriptsize
{$
\textrm
{
y
}$}}
;
\draw
[thick,->] (x.north) -- (layer1.south);
\draw
[thick,->] (layer1.north) -- (layer2.south);
\draw
[thick,->] (layer2.north) -- (layer3.south);
\draw
[thick,->] (layer3.north) -- (y.south);
\node
[anchor=west,align=left] (xshape) at (x.east)
{
\tiny
{
shape: 3*4*5
}}
;
\node
[anchor=west,align=left] (yshape) at (y.east)
{
\tiny
{
shape: 3*4*4
}}
;
\node
[anchor=south west,align=left,inner sep=2pt] (l1shape) at (layer1.north)
{
\tiny
{
shape: 3*4*3
}}
;
\node
[anchor=south west,align=left,inner sep=2pt] (l2shape) at (layer2.north)
{
\tiny
{
shape: 3*4*6
}}
;
\end{tikzpicture}
\end{center}
\end{tcolorbox}
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-code-tensor-define-2.tex
查看文件 @
071ff6c5
...
@@ -10,5 +10,33 @@
...
@@ -10,5 +10,33 @@
}
}
\end{flushleft}
\end{flushleft}
\end{tcolorbox}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(a) NiuTensor定义张量程序
}
\\
\begin{tcolorbox}
[enhanced,width=11cm,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{flushleft}
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor a, b, c;
}
\hspace
{
11.5em
}
\=
// 声明张量tensor
\\
\texttt
{
InitTensor1D(
\&
a, 10, X
\_
INT);
}
\>
// 10维的整数型向量
\\
\texttt
{
InitTensor1D(
\&
b, 10);
}
\>
// 10维的向量,缺省类型(浮点)
\\
\texttt
{
InitTensor4D(
\&
c, 10, 20, 30, 40);
}
\>
// 10*20*30*40的4阶张量(浮点)
\end{tabbing}
}
\end{flushleft}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(b) 定义张量的简便方式程序
}
\\
\begin{tcolorbox}
[enhanced,width=11cm,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{flushleft}
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor tensorGPU;
}
\hspace
{
10.5em
}
\=
// 声明张量tensor
\\
\texttt
{
InitTensor2D(
\&
tensorGPU, 10, 20,
}
$
\backslash
$
\>
// 在编号为0的GPU上定义张量
\\
\hspace
{
6.7em
}
\texttt
{
X
\_
FLOAT, 0);
}
\end{tabbing}
}
\end{flushleft}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(c) 在GPU上定义张量程序
}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-code-tensor-define-3.tex
deleted
100644 → 0
查看文件 @
1b087c3f
%%%------------------------------------------------------------------------------------------------------------
\begin{tcolorbox}
[enhanced,width=11cm,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{flushleft}
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor a, b, c;
}
\hspace
{
11.5em
}
\=
// 声明张量tensor
\\
\texttt
{
InitTensor1D(
\&
a, 10, X
\_
INT);
}
\>
// 10维的整数型向量
\\
\texttt
{
InitTensor1D(
\&
b, 10);
}
\>
// 10维的向量,缺省类型(浮点)
\\
\texttt
{
InitTensor4D(
\&
c, 10, 20, 30, 40);
}
\>
// 10*20*30*40的4阶张量(浮点)
\end{tabbing}
}
\end{flushleft}
\end{tcolorbox}
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-code-tensor-define-GPU.tex
deleted
100644 → 0
查看文件 @
1b087c3f
%%%------------------------------------------------------------------------------------------------------------
\begin{tcolorbox}
[enhanced,width=11cm,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{flushleft}
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor tensorGPU;
}
\hspace
{
10.5em
}
\=
// 声明张量tensor
\\
\texttt
{
InitTensor2D(
\&
tensorGPU, 10, 20,
}
$
\backslash
$
\>
// 在编号为0的GPU上定义张量
\\
\hspace
{
6.7em
}
\texttt
{
X
\_
FLOAT, 0);
}
\end{tabbing}
}
\end{flushleft}
\end{tcolorbox}
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-code-tensor-mul.tex
deleted
100644 → 0
查看文件 @
1b087c3f
%%%------------------------------------------------------------------------------------------------------------
\begin{tcolorbox}
[enhanced,width=11cm,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{flushleft}
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor a, b, c;
}
\hspace
{
10.0em
}
\=
// 声明张量tensor
\\
\texttt
{
InitTensor4D(
\&
a, 2, 2, 3, 4);
}
\>
// a为2*2*3*4的4阶张量
\\
\texttt
{
InitTensor2D(
\&
b, 4, 5);
}
\>
// b为4*5的矩阵
\\
\texttt
{
a.SetDataRand();
}
\>
// 随机初始化a
\\
\texttt
{
b.SetDataRand();
}
\>
// 随机初始化b
\\
\texttt
{
c = MMul(a, b);
}
\>
// 矩阵乘的结果为2*2*3*5的4阶张量
\end{tabbing}
}
\end{flushleft}
\end{tcolorbox}
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-code-tensor-operation.tex
查看文件 @
071ff6c5
...
@@ -17,5 +17,22 @@
...
@@ -17,5 +17,22 @@
}
}
\end{flushleft}
\end{flushleft}
\end{tcolorbox}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(a) 张量进行1阶运算
}
\\
\begin{tcolorbox}
[enhanced,width=11cm,frame engine=empty,boxrule=0.1mm,size=title,colback=blue!10!white]
\begin{flushleft}
{
\scriptsize
\begin{tabbing}
\texttt
{
XTensor a, b, c;
}
\hspace
{
10.0em
}
\=
// 声明张量tensor
\\
\texttt
{
InitTensor4D(
\&
a, 2, 2, 3, 4);
}
\>
// a为2*2*3*4的4阶张量
\\
\texttt
{
InitTensor2D(
\&
b, 4, 5);
}
\>
// b为4*5的矩阵
\\
\texttt
{
a.SetDataRand();
}
\>
// 随机初始化a
\\
\texttt
{
b.SetDataRand();
}
\>
// 随机初始化b
\\
\texttt
{
c = MMul(a, b);
}
\>
// 矩阵乘的结果为2*2*3*5的4阶张量
\end{tabbing}
}
\end{flushleft}
\end{tcolorbox}
\hspace
{
0.1in
}
\scriptsize
{
(b) 张量之间的矩阵乘法
}
%%%------------------------------------------------------------------------------------------------------------
%%%------------------------------------------------------------------------------------------------------------
Book/Chapter5/Figures/fig-rnn-model.tex
查看文件 @
071ff6c5
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\begin{tikzpicture}
\begin{scope}
\begin{scope}
\tikzstyle
{
rnnnode
}
= [draw,inner sep=5pt,minimum width=4em,minimum height=1.5em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
]
\tikzstyle
{
rnnnode
}
= [draw,inner sep=5pt,minimum width=4em,minimum height=1.5em,fill=green!30!white,blur shadow=
{
shadow xshift=1pt,shadow yshift=-1pt
}
]
...
@@ -63,7 +62,7 @@
...
@@ -63,7 +62,7 @@
\draw
[->,thick] ([xshift=0.1em]node14.east)--([xshift=1em]node14.east);
\draw
[->,thick] ([xshift=0.1em]node14.east)--([xshift=1em]node14.east);
{
{
\node
[anchor=south] (toplabel1) at ([yshift=2em,xshift=-
2
em]node32new.north)
{
\footnotesize
{
``苹果''的表示:
}}
;
\node
[anchor=south] (toplabel1) at ([yshift=2em,xshift=-
1.3
em]node32new.north)
{
\footnotesize
{
``苹果''的表示:
}}
;
\node
[anchor=west,fill=blue!20!white,minimum width=3em] (toplabel2) at (toplabel1.east)
{
\footnotesize
{
上下文
}}
;
\node
[anchor=west,fill=blue!20!white,minimum width=3em] (toplabel2) at (toplabel1.east)
{
\footnotesize
{
上下文
}}
;
}
}
{
{
...
@@ -82,6 +81,4 @@
...
@@ -82,6 +81,4 @@
\end{pgfonlayer}
\end{pgfonlayer}
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------
\ No newline at end of file
Book/Chapter5/Figures/fig-sawtooth.tex
查看文件 @
071ff6c5
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
\end{scope}
\end{scope}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{scope}
[yshift=-
2
in]
\begin{scope}
[yshift=-
1.8
in]
\node
[anchor=center,color=red] (node1) at (0,0)
{}
;
\node
[anchor=center,color=red] (node1) at (0,0)
{}
;
...
...
Book/Chapter5/Figures/fig-transformer-LM.tex
查看文件 @
071ff6c5
\begin{tikzpicture}
\begin{tikzpicture}
\begin{scope}
\begin{scope}
\node
[anchor=west] (w0) at (0,0)
{
\footnotesize
{$
w
_{
0
}$}}
;
\node
[anchor=west] (w0) at (0,0)
{
\footnotesize
{$
w
_{
0
}$}}
;
\node
[anchor=west] (w1) at ([xshift=
6.5
em]w0.east)
{
\footnotesize
{$
w
_{
1
}$}}
;
\node
[anchor=west] (w1) at ([xshift=
7
em]w0.east)
{
\footnotesize
{$
w
_{
1
}$}}
;
\node
[anchor=west] (w2) at ([xshift=
6.5
em]w1.east)
{
\footnotesize
{$
w
_{
2
}$}}
;
\node
[anchor=west] (w2) at ([xshift=
7
em]w1.east)
{
\footnotesize
{$
w
_{
2
}$}}
;
\node
[anchor=west] (w3) at ([xshift=
6.5
em]w2.east)
{
\footnotesize
{$
w
_{
3
}$}}
;
\node
[anchor=west] (w3) at ([xshift=
7
em]w2.east)
{
\footnotesize
{$
w
_{
3
}$}}
;
\node
[anchor=north] (index0) at ([yshift=0.5em]w0.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index0) at ([yshift=0.5em]w0.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index1) at ([yshift=0.5em]w1.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index1) at ([yshift=0.5em]w1.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index2) at ([yshift=0.5em]w2.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index2) at ([yshift=0.5em]w2.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index3) at ([yshift=0.5em]w3.south)
{
\footnotesize
(index)
}
;
\node
[anchor=north] (index3) at ([yshift=0.5em]w3.south)
{
\footnotesize
(index)
}
;
{
{
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
20!white
] (e0) at ([yshift=1em]w0.north)
{
\footnotesize
{$
\textbf
{
e
}_
0
=
w
_{
0
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
0
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
30!white,minimum width=7.5em
] (e0) at ([yshift=1em]w0.north)
{
\footnotesize
{$
\textbf
{
e
}_
0
=
w
_{
0
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
0
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
20!white
] (e1) at ([yshift=1em]w1.north)
{
\footnotesize
{$
\textbf
{
e
}_
1
=
w
_{
1
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
1
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
30!white,minimum width=7.5em
] (e1) at ([yshift=1em]w1.north)
{
\footnotesize
{$
\textbf
{
e
}_
1
=
w
_{
1
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
1
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
20!white
] (e2) at ([yshift=1em]w2.north)
{
\footnotesize
{$
\textbf
{
e
}_
2
=
w
_{
2
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
2
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
30!white,minimum width=7.5em
] (e2) at ([yshift=1em]w2.north)
{
\footnotesize
{$
\textbf
{
e
}_
2
=
w
_{
2
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
2
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
20!white
] (e3) at ([yshift=1em]w3.north)
{
\footnotesize
{$
\textbf
{
e
}_
3
=
w
_{
3
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
3
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=blue!
30!white,minimum width=7.5em
] (e3) at ([yshift=1em]w3.north)
{
\footnotesize
{$
\textbf
{
e
}_
3
=
w
_{
3
}
\textbf
{
C
}
+
\textrm
{
PE
}
(
3
)
$}}
;
}
}
{
{
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=
ugreen!20!white] (h0) at ([xshift=-0.5em,
yshift=2.0em]e0.north)
{
\footnotesize
{$
\textbf
{
h
}_{
0
}
=
\textrm
{
SelfAtt
}
(
\textbf
{
e
}_
0
,
\textbf
{
e
}_
3
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=
green!30!white] (h0) at ([
yshift=2.0em]e0.north)
{
\footnotesize
{$
\textbf
{
h
}_{
0
}
=
\textrm
{
SelfAtt
}
(
\textbf
{
e
}_
0
,
\textbf
{
e
}_
3
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=
ugreen!20!white] (h1) at ([xshift=0.5em,
yshift=2.0em]e1.north)
{
\footnotesize
{$
\textbf
{
h
}_{
1
}
=
\textrm
{
SelfAtt
}
(
\textbf
{
e
}_
1
,
\textbf
{
e
}_
3
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=
green!30!white] (h1) at ([
yshift=2.0em]e1.north)
{
\footnotesize
{$
\textbf
{
h
}_{
1
}
=
\textrm
{
SelfAtt
}
(
\textbf
{
e
}_
1
,
\textbf
{
e
}_
3
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=
ugreen!20!white] (h2) at ([xshift=1.5em,
yshift=2.0em]e2.north)
{
\footnotesize
{$
\textbf
{
h
}_{
2
}
=
\textrm
{
SelfAtt
}
(
\textbf
{
e
}_
2
,
\textbf
{
e
}_
3
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,inner sep=3pt,fill=
green!30!white] (h2) at ([
yshift=2.0em]e2.north)
{
\footnotesize
{$
\textbf
{
h
}_{
2
}
=
\textrm
{
SelfAtt
}
(
\textbf
{
e
}_
2
,
\textbf
{
e
}_
3
)
$}}
;
}
}
{
{
\node
[anchor=south,line width=0.8pt,draw,minimum width=9em,inner sep=3pt,fill=orange!
20!white] (f1) at ([xshift=0.5em,
yshift=2.0em]h2.north)
{
\footnotesize
{$
\textbf
{
f
}_
3
=
\textrm
{
FNN
}
([
\textbf
{
h
}_
0
,
\textbf
{
h
}_
1
,
\textbf
{
h
}_
2
,
\textbf
{
e
}_
3
])
$}}
;
\node
[anchor=south,line width=0.8pt,draw,minimum width=9em,inner sep=3pt,fill=orange!
30!white] (f1) at ([
yshift=2.0em]h2.north)
{
\footnotesize
{$
\textbf
{
f
}_
3
=
\textrm
{
FNN
}
([
\textbf
{
h
}_
0
,
\textbf
{
h
}_
1
,
\textbf
{
h
}_
2
,
\textbf
{
e
}_
3
])
$}}
;
\node
[anchor=south,line width=0.8pt,draw,minimum width=9
em,inner sep=3pt,fill=orange!2
0!white] (o1) at ([yshift=1.2em]f1.north)
{
\footnotesize
{$
\textbf
{
y
}
=
\textrm
{
Softmax
}
(
f
_
3
\textbf
{
U
}
)
$}}
;
\node
[anchor=south,line width=0.8pt,draw,minimum width=9
.5em,inner sep=3pt,fill=orange!3
0!white] (o1) at ([yshift=1.2em]f1.north)
{
\footnotesize
{$
\textbf
{
y
}
=
\textrm
{
Softmax
}
(
f
_
3
\textbf
{
U
}
)
$}}
;
}
}
\node
[anchor=south] (ylabel) at ([yshift=1.2em]o1.north)
{
\footnotesize
{$
\textrm
{
P
}
(
w
_
4
|w
_{
0
}
w
_{
1
}
w
_{
2
}
w
_{
3
}
)
$}}
;
\node
[anchor=south] (ylabel) at ([yshift=1.2em]o1.north)
{
\footnotesize
{$
\textrm
{
P
}
(
w
_
4
|w
_{
0
}
w
_{
1
}
w
_{
2
}
w
_{
3
}
)
$}}
;
...
@@ -34,11 +34,11 @@
...
@@ -34,11 +34,11 @@
\draw
[->,line width=0.6pt] ([yshift=0.1em]w2.north) -- ([yshift=-0.1em]e2.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]w2.north) -- ([yshift=-0.1em]e2.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]w3.north) -- ([yshift=-0.1em]e3.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]w3.north) -- ([yshift=-0.1em]e3.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e0.north) -- ([xshift=0em,yshift=-0.1em]h0.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e0.north) -- ([xshift=0em,yshift=-0.1em]h0.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e1.north) -- ([xshift=
-0.5
em,yshift=-0.1em]h1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e1.north) -- ([xshift=
0
em,yshift=-0.1em]h1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e2.north) -- ([xshift=
-1
em,yshift=-0.1em]h2.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e2.north) -- ([xshift=
0
em,yshift=-0.1em]h2.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=
1
em,yshift=-0.1em]h0.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=
0.4
em,yshift=-0.1em]h0.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=
1
em,yshift=-0.1em]h1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=
0.4
em,yshift=-0.1em]h1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=
1
em,yshift=-0.1em]h2.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=
0.4
em,yshift=-0.1em]h2.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]h0.north) -- ([xshift=-2em,yshift=-0.1em]f1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]h0.north) -- ([xshift=-2em,yshift=-0.1em]f1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=2em,yshift=-0.1em]f1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]e3.north) -- ([xshift=2em,yshift=-0.1em]f1.south);
...
@@ -47,4 +47,4 @@
...
@@ -47,4 +47,4 @@
\draw
[->,line width=0.6pt] ([yshift=0.1em]f1.north) -- ([yshift=-0.1em]o1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]f1.north) -- ([yshift=-0.1em]o1.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]o1.north) -- ([yshift=-0.1em]ylabel.south);
\draw
[->,line width=0.6pt] ([yshift=0.1em]o1.north) -- ([yshift=-0.1em]ylabel.south);
\end{scope}
\end{scope}
\end{tikzpicture}
\end{tikzpicture}
\ No newline at end of file
Book/Chapter5/Figures/fig-weather.tex
查看文件 @
071ff6c5
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
\node
[rectangle,rounded corners,draw=black!50,densely dashed,inner sep=0.4em] [fit = (part2-1) (part2-2) (hidlabel) ] (inputshadow)
{}
;
\node
[rectangle,rounded corners,draw=black!50,densely dashed,inner sep=0.4em] [fit = (part2-1) (part2-2) (hidlabel) ] (inputshadow)
{}
;
\node
[circle,anchor=west,draw=ublue,minimum width=2.5em,fill=blue!20,inner sep=2pt] (part2-3) at ([xshift=2.0em,yshift=-1.7em]part1-3.east)
{
\scriptsize
{
偏置2
}}
;
\node
[circle,anchor=west,draw=ublue,minimum width=2.5em,fill=blue!20,inner sep=2pt] (part2-3) at ([xshift=2.0em,yshift=-1.7em]part1-3.east)
{
\scriptsize
{
偏置2
}}
;
\node
[anchor=north,minimum width=3.0em] (part2-4) at ([xshift=0.0em,yshift=-1.6em]part2-3.south)
{
\scriptsize
{
隐藏层
}}
;
\node
[anchor=north,minimum width=3.0em] (part2-4) at ([xshift=0.0em,yshift=-1.6em]part2-3.south)
{
\scriptsize
{
隐藏层
}}
;
\node
[anchor=north] (labela) at ([xshift=0.0em,yshift=-
4
em]part2-3.south)
{
\footnotesize
{
(a)
}}
;
\node
[anchor=north] (labela) at ([xshift=0.0em,yshift=-
3
em]part2-3.south)
{
\footnotesize
{
(a)
}}
;
%右
%右
\node
[anchor=west,draw=ublue,minimum width=3.0em,fill=purple!20] (part3-1) at ([xshift=2em,yshift=0.0em]part2-2.east)
{
\scriptsize
{
穿衣指数
}}
;
\node
[anchor=west,draw=ublue,minimum width=3.0em,fill=purple!20] (part3-1) at ([xshift=2em,yshift=0.0em]part2-2.east)
{
\scriptsize
{
穿衣指数
}}
;
...
@@ -67,7 +67,7 @@ y
...
@@ -67,7 +67,7 @@ y
\node
[rectangle,rounded corners,draw=black!50,densely dashed,inner sep=0.4em] [fit = (part2-1) (part2-2) (hidlabel) ] (inputshadow)
{}
;
\node
[rectangle,rounded corners,draw=black!50,densely dashed,inner sep=0.4em] [fit = (part2-1) (part2-2) (hidlabel) ] (inputshadow)
{}
;
\node
[circle,anchor=west,draw=ublue,minimum width=2.5em,fill=blue!20,inner sep=2pt] (part2-3) at ([xshift=2.0em,yshift=-1.7em]part1-3.east)
{
\large
{$
b
^{
[
2
]
}
$}}
;
\node
[circle,anchor=west,draw=ublue,minimum width=2.5em,fill=blue!20,inner sep=2pt] (part2-3) at ([xshift=2.0em,yshift=-1.7em]part1-3.east)
{
\large
{$
b
^{
[
2
]
}
$}}
;
\node
[anchor=north,minimum width=3.0em] (part2-4) at ([xshift=0.0em,yshift=-1.6em]part2-3.south)
{
\scriptsize
{
隐藏层
}}
;
\node
[anchor=north,minimum width=3.0em] (part2-4) at ([xshift=0.0em,yshift=-1.6em]part2-3.south)
{
\scriptsize
{
隐藏层
}}
;
\node
[anchor=north] (labelb) at ([xshift=0.0em,yshift=-
4
em]part2-3.south)
{
\footnotesize
{
(b)
}}
;
\node
[anchor=north] (labelb) at ([xshift=0.0em,yshift=-
3
em]part2-3.south)
{
\footnotesize
{
(b)
}}
;
%右
%右
...
...
Book/Chapter5/chapter5.tex
查看文件 @
071ff6c5
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论