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
f6e47ea1
Commit
f6e47ea1
authored
Dec 17, 2019
by
Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add softmax figure
parent
f7c5d4e6
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
216 行增加
和
36 行删除
+216
-36
Section06-Neural-Machine-Translation/section06-test.tex
+91
-36
Section06-Neural-Machine-Translation/section06.tex
+125
-0
没有找到文件。
Section06-Neural-Machine-Translation/section06-test.tex
查看文件 @
f6e47ea1
...
...
@@ -160,67 +160,122 @@
% RNN translation model
\begin{scope}
[local bounding box=RNNMT]
% RNN Encoder
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west]
(eemb1) at (0,0)
{
\tiny
{$
e
_
x
()
$}}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(enc1) at ([yshift=0.3
\base
]eemb1.north)
{}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel1) at (enc1)
{
\tiny
{$
\textbf
{
h
}_{
m
}$}}
;
\coordinate
(eemb0) at (0,0);
\foreach
\x
[count=
\y
from 0] in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west]
(eemb
\x
) at ([xshift=0.4
\base
]eemb
\y
.east)
{
\tiny
{$
e
_
x
()
$}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(enc
\x
) at ([yshift=0.3
\base
]eemb
\x
.north)
{}
;
\node
[]
(enclabel1) at (enc1)
{
\tiny
{$
\textbf
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel2) at (enc2)
{
\tiny
{$
\textbf
{
h
}_{
m
-
1
}$}}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel3) at (enc3)
{
\tiny
{$
\textbf
{
h
}_{
m
}$}}
;
\node
[wordnode,left=0.4\base of enc1]
(init1)
{$
\cdots
$}
;
\node
[wordnode,left=0.4\base of eemb1]
(init2)
{$
\cdots
$}
;
\node
[wordnode,below=0pt of eemb1]
()
{$
\langle
$
eos
$
\rangle
$}
;
\node
[wordnode,below=0pt of eemb1]
()
{
走
}
;
\node
[wordnode,below=0pt of eemb2]
()
{
吗
}
;
\node
[wordnode,below=0pt of eemb3]
()
{$
\langle
$
eos
$
\rangle
$}
;
% RNN Decoder
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb1) at ([yshift=
\base
]enc1.north)
{
\tiny
{$
e
_
y
()
$}}
;
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec1) at ([yshift=0.3
\base
]demb1.north)
{{
\tiny
{$
\textbf
{
s
}_
1
$}}}
;
\node
[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south]
(softmax1) at ([yshift=0.3
\base
]dec1.north)
{
\tiny
{
Softmax
}}
;
\node
[wordnode,right=0.4\base of demb1]
(end1)
{$
\cdots
$}
;
\node
[wordnode,right=0.4\base of dec1]
(end2)
{$
\cdots
$}
;
\node
[wordnode,right=0.4\base of softmax1]
(end3)
{$
\cdots
$}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([yshift=
\base
]enc
\x
.north)
{
\tiny
{$
e
_
y
()
$}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.3
\base
]demb
\x
.north)
{{
\tiny
{$
\textbf
{
s
}_
\x
$}}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south]
(softmax
\x
) at ([yshift=0.3
\base
]dec
\x
.north)
{
\tiny
{
Softmax
}}
;
\node
[wordnode,right=0.4\base of demb3]
(end1)
{$
\cdots
$}
;
\node
[wordnode,right=0.4\base of dec3]
(end2)
{$
\cdots
$}
;
\node
[wordnode,right=0.4\base of softmax3]
(end3)
{$
\cdots
$}
;
% Decoder input words
\node
[wordnode,below=0pt of demb1]
(decwordin)
{$
\langle
$
sos
$
\rangle
$}
;
\ExtractX
{$
(
demb
2
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Do
}
;
\ExtractX
{$
(
demb
3
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
you
}
;
% Decoder output words
\node
[wordnode,above=0pt of softmax1]
(decwordout)
{
Do
}
;
\ExtractX
{$
(
softmax
2
.north
)
$}
\ExtractY
{$
(
decwordout.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
you
}
;
\ExtractX
{$
(
softmax
3
.north
)
$}
\ExtractY
{$
(
decwordout.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
know
}
;
% Connections
\draw
[-latex']
(init1.east) to (enc1.west);
\draw
[-latex']
(dec1.east) to (end2.west);
\draw
[-latex']
(eemb1) to (enc1);
\draw
[-latex']
(demb1) to (dec1);
\draw
[-latex']
(dec1.north) to (softmax1.south);
\coordinate
(bridge) at ([yshift=0.4
\base
]enc1.north west);
\draw
[-latex']
(enc1.north) to [out=90,in=0] (bridge) to [out=180,in=180] (dec1.west);
\draw
[-latex']
(dec3.east) to (end2.west);
\foreach
\x
in
{
1,2,...,3
}
\draw
[-latex']
(eemb
\x
) to (enc
\x
);
\foreach
\x
in
{
1,2,...,3
}
\draw
[-latex']
(demb
\x
) to (dec
\x
);
\foreach
\x
in
{
1,2,...,3
}
\draw
[-latex']
(dec
\x
.north) to (softmax
\x
.south);
\foreach
\x
[count=
\y
from 2] in
{
1,2
}
{
\draw
[-latex']
(enc
\x
.east) to (enc
\y
.west);
\draw
[-latex']
(dec
\x
.east) to (dec
\y
.west);
}
\coordinate
(bridge) at ([yshift=0.4
\base
]enc2.north west);
\draw
[-latex']
(enc3.north) .. controls +(north:0.3
\base
) and +(east:
\base
) .. (bridge) .. controls +(west:2.7
\base
) and +(west:0.3
\base
) .. (dec1.west);
\end{scope}
\begin{scope}
\coordinate
(start) at (7
\base
,0);
\node
[anchor=center,minimum width=6.7em,minimum height=1.8em,draw,rounded corners=0.3em] (hidden) at (start)
{}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!20] (cell01) at ([xshift=0.2em]hidden.west)
{
\footnotesize
{
.2
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!10] (cell02) at (cell01.east)
{
\footnotesize
{
-1
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=white] (cell03) at (cell02.east)
{
\footnotesize
{$
\cdots
$}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!50] (cell04) at (cell03.east)
{
\footnotesize
{
5
}}
;
\node
[anchor=south,minimum width=12.9em,minimum height=1.8em,draw,rounded corners=0.3em] (target) at ([yshift=3em]hidden.north)
{}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!10] (cell11) at ([xshift=0.2em]target.west)
{
\footnotesize
{
-2
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!10] (cell12) at (cell11.east)
{
\footnotesize
{
-1
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!70] (cell13) at (cell12.east)
{
\footnotesize
{
6
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=white] (cell14) at (cell13.east)
{
\footnotesize
{$
\cdots
$}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!30] (cell15) at (cell14.east)
{
\footnotesize
{
.7
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!10] (cell16) at (cell15.east)
{
\footnotesize
{
-3
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!10] (cell17) at (cell16.east)
{
\footnotesize
{
-1
}}
;
\node
[anchor=west,minimum width=1.5em,minimum size=1.5em,fill=ugreen!20] (cell18) at (cell17.east)
{
\footnotesize
{
.2
}}
;
\coordinate
(start) at (8.5
\base
,-0.3
\base
);
\node
[anchor=center,minimum width=5.7em,minimum height=1.3em,draw,rounded corners=0.3em] (hidden) at (start)
{}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!20] (cell01) at ([xshift=0.2em]hidden.west)
{
\scriptsize
{
.2
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell02) at (cell01.east)
{
\scriptsize
{
-1
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=white] (cell03) at (cell02.east)
{
\scriptsize
{$
\cdots
$}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!50] (cell04) at (cell03.east)
{
\scriptsize
{
5
}}
;
\node
[anchor=south,minimum width=10.9em,minimum height=1.3em,draw,rounded corners=0.3em] (target) at ([yshift=2.4em]hidden.north)
{}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell11) at ([xshift=0.2em]target.west)
{
\scriptsize
{
-2
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell12) at (cell11.east)
{
\scriptsize
{
-1
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!70] (cell13) at (cell12.east)
{
\scriptsize
{
6
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=white] (cell14) at (cell13.east)
{
\scriptsize
{$
\cdots
$}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!30] (cell15) at (cell14.east)
{
\scriptsize
{
.7
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell16) at (cell15.east)
{
\scriptsize
{
-3
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell17) at (cell16.east)
{
\scriptsize
{
-1
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!20] (cell18) at (cell17.east)
{
\scriptsize
{
.2
}}
;
\node
[anchor=south,minimum width=1em,minimum height=0.2em,fill=ublue!80,inner sep=0pt] (label1) at ([yshift=3em]cell11.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w1) at (label1.north)
{$
\langle
$
eos
$
\rangle
$}
;
\node
[anchor=south,minimum width=1em,minimum height=0.3em,fill=ublue!80,inner sep=0pt] (label2) at ([yshift=3em]cell12.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w2) at (label2.north)
{$
\langle
$
sos
$
\rangle
$}
;
\node
[anchor=south,minimum width=1em,minimum height=1.5em,fill=ublue!80,inner sep=0pt] (label3) at ([yshift=3em]cell13.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w3) at (label3.north)
{
Do
}
;
\node
[anchor=south,font=
\scriptsize
] (w4) at ([yshift=3em]cell14.north)
{$
\cdots
$}
;
\node
[anchor=south,minimum width=1em,minimum height=0.5em,fill=ublue!80,inner sep=0pt] (label5) at ([yshift=3em]cell15.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w5) at (label5.north)
{
I
}
;
\node
[anchor=south,minimum width=1em,minimum height=0.1em,fill=ublue!80,inner sep=0pt] (label6) at ([yshift=3em]cell16.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w6) at (label6.north)
{
you
}
;
\node
[anchor=south,minimum width=1em,minimum height=0.3em,fill=ublue!80,inner sep=0pt] (label7) at ([yshift=3em]cell17.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w7) at (label7.north)
{
?
}
;
\node
[anchor=south,minimum width=1em,minimum height=0.4em,fill=ublue!80,inner sep=0pt] (label8) at ([yshift=3em]cell18.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w8) at (label8.north)
{
have
}
;
\filldraw
[fill=red!20,draw=white] (target.south west) -- (target.south east) -- ([xshift=-0.2em,yshift=0.1em]hidden.north east) -- ([xshift=0.2em,yshift=0.1em]hidden.north west);
\draw
[->,thick] ([xshift=0.2em,yshift=0.1em]hidden.north west) -- (target.south west);
\draw
[->,thick] ([xshift=-0.2em,yshift=0.1em]hidden.north east) -- (target.south east);
\node
[anchor=south] () at ([yshift=0.9em]hidden.north)
{$
y
=
Wx
$}
;
\node
[anchor=south,rounded corners=0.3em] (softmax) at ([yshift=0.5em]target.north)
{
\scriptsize
{$
p
(
\hat
{
s
}
)
_
i
=
\frac
{
e
^{
\hat
{
s
}_
i
}}{
\sum
_
j e
^{
\hat
{
s
}_
j
}}$}}
;
\begin{pgfonlayer}
{
background
}
\filldraw
[fill=blue!20,draw=white] ([yshift=0.1em]cell11.north west)
{
[rounded corners=0.3em] -- (softmax.west)
}
-- (label1.south west) -- (label8.south east)
{
[rounded corners=0.3em] -- (softmax.east)
}
-- ([yshift=0.1em]cell18.north east) -- ([yshift=0.1em]cell11.north west);
\end{pgfonlayer}
\node
[anchor=south] () at ([yshift=0.6em]hidden.north)
{
\scriptsize
{$
\hat
{
s
}
=
Ws
$}}
;
\node
[draw=red,thick,densely dashed,rounded corners=3pt,fit=(cell01) (cell11) (label1) (label8) (target) (hidden) (w3)] (output)
{}
;
\end{scope}
\draw
[->,thick,densely dashed,red] ([yshift=-0.2em]softmax3.east) .. controls +(east:2
\base
) and +(west:
\base
) .. (output.west);
\end{tikzpicture}
\end{center}
\end{frame}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
\section
{
Transformer
}
...
...
Section06-Neural-Machine-Translation/section06.tex
查看文件 @
f6e47ea1
...
...
@@ -1145,6 +1145,131 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\item
Softmax
\end{itemize}
%%% 图
\begin{center}
\begin{tikzpicture}
\setlength
{
\base
}{
0.9cm
}
\tikzstyle
{
rnnnode
}
= [rounded corners=1pt,minimum height=0.5
\base
,minimum width=1
\base
,draw,inner sep=0pt,outer sep=0pt]
\tikzstyle
{
wordnode
}
= [font=
\tiny
]
% RNN translation model
\begin{scope}
[local bounding box=RNNMT]
% RNN Encoder
\coordinate
(eemb0) at (0,0);
\foreach
\x
[count=
\y
from 0] in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=west]
(eemb
\x
) at ([xshift=0.4
\base
]eemb
\y
.east)
{
\tiny
{$
e
_
x
()
$}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(enc
\x
) at ([yshift=0.3
\base
]eemb
\x
.north)
{}
;
\node
[]
(enclabel1) at (enc1)
{
\tiny
{$
\textbf
{
h
}_{
m
-
2
}$}}
;
\node
[]
(enclabel2) at (enc2)
{
\tiny
{$
\textbf
{
h
}_{
m
-
1
}$}}
;
\node
[rnnnode,fill=purple!30!white]
(enclabel3) at (enc3)
{
\tiny
{$
\textbf
{
h
}_{
m
}$}}
;
\node
[wordnode,left=0.4\base of enc1]
(init1)
{$
\cdots
$}
;
\node
[wordnode,left=0.4\base of eemb1]
(init2)
{$
\cdots
$}
;
\node
[wordnode,below=0pt of eemb1]
()
{
走
}
;
\node
[wordnode,below=0pt of eemb2]
()
{
吗
}
;
\node
[wordnode,below=0pt of eemb3]
()
{$
\langle
$
eos
$
\rangle
$}
;
% RNN Decoder
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=green!30!white,anchor=south]
(demb
\x
) at ([yshift=
\base
]enc
\x
.north)
{
\tiny
{$
e
_
y
()
$}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,fill=blue!30!white,anchor=south]
(dec
\x
) at ([yshift=0.3
\base
]demb
\x
.north)
{{
\tiny
{$
\textbf
{
s
}_
\x
$}}}
;
\foreach
\x
in
{
1,2,...,3
}
\node
[rnnnode,minimum height=0.5\base,fill=red!30!white,anchor=south]
(softmax
\x
) at ([yshift=0.3
\base
]dec
\x
.north)
{
\tiny
{
Softmax
}}
;
\node
[wordnode,right=0.4\base of demb3]
(end1)
{$
\cdots
$}
;
\node
[wordnode,right=0.4\base of dec3]
(end2)
{$
\cdots
$}
;
\node
[wordnode,right=0.4\base of softmax3]
(end3)
{$
\cdots
$}
;
% Decoder input words
\node
[wordnode,below=0pt of demb1]
(decwordin)
{$
\langle
$
sos
$
\rangle
$}
;
\ExtractX
{$
(
demb
2
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
Do
}
;
\ExtractX
{$
(
demb
3
.south
)
$}
\ExtractY
{$
(
decwordin.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
you
}
;
% Decoder output words
\node
[wordnode,above=0pt of softmax1]
(decwordout)
{
Do
}
;
\ExtractX
{$
(
softmax
2
.north
)
$}
\ExtractY
{$
(
decwordout.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
you
}
;
\ExtractX
{$
(
softmax
3
.north
)
$}
\ExtractY
{$
(
decwordout.base
)
$}
\node
[wordnode,anchor=base]
() at (
\XCoord
,
\YCoord
)
{
know
}
;
% Connections
\draw
[-latex']
(init1.east) to (enc1.west);
\draw
[-latex']
(dec3.east) to (end2.west);
\foreach
\x
in
{
1,2,...,3
}
\draw
[-latex']
(eemb
\x
) to (enc
\x
);
\foreach
\x
in
{
1,2,...,3
}
\draw
[-latex']
(demb
\x
) to (dec
\x
);
\foreach
\x
in
{
1,2,...,3
}
\draw
[-latex']
(dec
\x
.north) to (softmax
\x
.south);
\foreach
\x
[count=
\y
from 2] in
{
1,2
}
{
\draw
[-latex']
(enc
\x
.east) to (enc
\y
.west);
\draw
[-latex']
(dec
\x
.east) to (dec
\y
.west);
}
\coordinate
(bridge) at ([yshift=0.4
\base
]enc2.north west);
\draw
[-latex']
(enc3.north) .. controls +(north:0.3
\base
) and +(east:
\base
) .. (bridge) .. controls +(west:2.7
\base
) and +(west:0.3
\base
) .. (dec1.west);
\end{scope}
\begin{scope}
\coordinate
(start) at (8.5
\base
,-0.3
\base
);
\node
[anchor=center,minimum width=5.7em,minimum height=1.3em,draw,rounded corners=0.3em] (hidden) at (start)
{}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!20] (cell01) at ([xshift=0.2em]hidden.west)
{
\scriptsize
{
.2
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell02) at (cell01.east)
{
\scriptsize
{
-1
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=white] (cell03) at (cell02.east)
{
\scriptsize
{$
\cdots
$}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!50] (cell04) at (cell03.east)
{
\scriptsize
{
5
}}
;
\node
[anchor=south,minimum width=10.9em,minimum height=1.3em,draw,rounded corners=0.3em] (target) at ([yshift=2.4em]hidden.north)
{}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell11) at ([xshift=0.2em]target.west)
{
\scriptsize
{
-2
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell12) at (cell11.east)
{
\scriptsize
{
-1
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!70] (cell13) at (cell12.east)
{
\scriptsize
{
6
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=white] (cell14) at (cell13.east)
{
\scriptsize
{$
\cdots
$}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!30] (cell15) at (cell14.east)
{
\scriptsize
{
.7
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell16) at (cell15.east)
{
\scriptsize
{
-3
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!10] (cell17) at (cell16.east)
{
\scriptsize
{
-1
}}
;
\node
[anchor=west,minimum width=1em,minimum size=1em,fill=ugreen!20] (cell18) at (cell17.east)
{
\scriptsize
{
.2
}}
;
\node
[anchor=south,minimum width=1em,minimum height=0.2em,fill=ublue!80,inner sep=0pt] (label1) at ([yshift=3em]cell11.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w1) at (label1.north)
{$
\langle
$
eos
$
\rangle
$}
;
\node
[anchor=south,minimum width=1em,minimum height=0.3em,fill=ublue!80,inner sep=0pt] (label2) at ([yshift=3em]cell12.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w2) at (label2.north)
{$
\langle
$
sos
$
\rangle
$}
;
\node
[anchor=south,minimum width=1em,minimum height=1.5em,fill=ublue!80,inner sep=0pt] (label3) at ([yshift=3em]cell13.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w3) at (label3.north)
{
Do
}
;
\node
[anchor=south,font=
\scriptsize
] (w4) at ([yshift=3em]cell14.north)
{$
\cdots
$}
;
\node
[anchor=south,minimum width=1em,minimum height=0.5em,fill=ublue!80,inner sep=0pt] (label5) at ([yshift=3em]cell15.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w5) at (label5.north)
{
I
}
;
\node
[anchor=south,minimum width=1em,minimum height=0.1em,fill=ublue!80,inner sep=0pt] (label6) at ([yshift=3em]cell16.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w6) at (label6.north)
{
you
}
;
\node
[anchor=south,minimum width=1em,minimum height=0.3em,fill=ublue!80,inner sep=0pt] (label7) at ([yshift=3em]cell17.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w7) at (label7.north)
{
?
}
;
\node
[anchor=south,minimum width=1em,minimum height=0.4em,fill=ublue!80,inner sep=0pt] (label8) at ([yshift=3em]cell18.north)
{}
;
\node
[anchor=west,rotate=90,font=
\scriptsize
] (w8) at (label8.north)
{
have
}
;
\filldraw
[fill=red!20,draw=white] (target.south west) -- (target.south east) -- ([xshift=-0.2em,yshift=0.1em]hidden.north east) -- ([xshift=0.2em,yshift=0.1em]hidden.north west);
\draw
[->,thick] ([xshift=0.2em,yshift=0.1em]hidden.north west) -- (target.south west);
\draw
[->,thick] ([xshift=-0.2em,yshift=0.1em]hidden.north east) -- (target.south east);
\node
[anchor=south,rounded corners=0.3em] (softmax) at ([yshift=0.5em]target.north)
{
\scriptsize
{$
p
(
\hat
{
s
}
)
_
i
=
\frac
{
e
^{
\hat
{
s
}_
i
}}{
\sum
_
j e
^{
\hat
{
s
}_
j
}}$}}
;
\begin{pgfonlayer}
{
background
}
\filldraw
[fill=blue!20,draw=white] ([yshift=0.1em]cell11.north west)
{
[rounded corners=0.3em] -- (softmax.west)
}
-- (label1.south west) -- (label8.south east)
{
[rounded corners=0.3em] -- (softmax.east)
}
-- ([yshift=0.1em]cell18.north east) -- ([yshift=0.1em]cell11.north west);
\end{pgfonlayer}
\node
[anchor=south] () at ([yshift=0.6em]hidden.north)
{
\scriptsize
{$
\hat
{
s
}
=
Ws
$}}
;
\node
[draw=red,thick,densely dashed,rounded corners=3pt,fit=(cell01) (cell11) (label1) (label8) (target) (hidden) (w3)] (output)
{}
;
\end{scope}
\draw
[->,thick,densely dashed,red] ([yshift=-0.2em]softmax3.east) .. controls +(east:2
\base
) and +(west:
\base
) .. (output.west);
\end{tikzpicture}
\end{center}
\end{frame}
%%%------------------------------------------------------------------------------------------------------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论