Commit 5e608537 by Lee

Update LSTM figure

parent f1ce4cd8
...@@ -1149,7 +1149,7 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -1149,7 +1149,7 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
%%%------------------------------------------------------------------------------------------------------------ %%%------------------------------------------------------------------------------------------------------------
%%% LSTM %%% LSTM
\begin{frame}{模块3:循环单元 - 长短时记忆模型(LSTM) (2页?)} \begin{frame}{模块3:循环单元 - 长短时记忆模型(LSTM)}
\begin{itemize} \begin{itemize}
\item LSTM \item LSTM
\end{itemize} \end{itemize}
...@@ -1163,8 +1163,8 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -1163,8 +1163,8 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\tikzstyle{auxnode} = [inner sep=0pt,outer sep=0pt,opacity=0,draw=red,fill=red,circle,minimum size=3pt] \tikzstyle{auxnode} = [inner sep=0pt,outer sep=0pt,opacity=0,draw=red,fill=red,circle,minimum size=3pt]
\tikzstyle{opnode} = [inner sep=0pt,outer sep=0pt,draw,fill=green!30!white,font=\scriptsize,minimum size=10pt] \tikzstyle{opnode} = [inner sep=0pt,outer sep=0pt,draw,fill=green!30!white,font=\scriptsize,minimum size=10pt]
\tikzstyle{standard} = [rounded corners=5pt,thick] \tikzstyle{standard} = [rounded corners=5pt,thick]
\tikzstyle{emph} = [rounded corners=5pt,very thick,draw=red] \tikzstyle{emph} = [rounded corners=5pt,thick,draw=red]
\tikzstyle{formulanode} = [font=\scriptsize,align=left,draw=red,rectangle,fill=red!30!white,rounded corners=2pt,drop shadow] \tikzstyle{formulanode} = [font=\scriptsize,align=left,draw=red,rectangle,fill=red!10!white,rounded corners=2pt,drop shadow]
% Skeleton % Skeleton
\begin{scope}[every label/.append style={label distance=1pt,font=\tiny,inner sep=0pt,opacity=0}] \begin{scope}[every label/.append style={label distance=1pt,font=\tiny,inner sep=0pt,opacity=0}]
...@@ -1226,41 +1226,83 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -1226,41 +1226,83 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\end{scope} \end{scope}
\begin{scope} \begin{scope}
\node[opnode,circle] (f53) at (aux53) {}; \node[opnode,circle,opacity=0] (f53) at (aux53) {};
\node[opnode,circle] (u55) at (aux55) {}; \node[opnode,circle,opacity=0] (u55) at (aux55) {};
% forget gate % forget gate
\draw[standard] (aux21) -- (aux23) -- (aux33); \visible<1>{
\draw[-latex,standard] (aux12) -- (aux22) -- (aux23) -- (f53); \draw[emph] (aux21) -- (aux23) -- (aux33);
\node[opnode,circle] () at (aux33) {$\sigma$}; \draw[-latex,emph] (aux12) -- (aux22) -- (aux23) -- (f53);
\node[opnode,circle,draw=red,thick] () at (aux33) {$\sigma$};
}
\visible<2->{
\draw[standard] (aux21) -- (aux23) -- (aux33);
\draw[-latex,standard] (aux12) -- (aux22) -- (aux23) -- (f53);
\node[opnode,circle] () at (aux33) {$\sigma$};
}
% input gate % input gate
\node[opnode,circle] (i45) at (aux45) {}; \visible<2>{
\draw[-latex,standard] (aux21) -- (aux24) |- (i45); \node[opnode,circle] (i45) at (aux45) {};
\draw[-latex,standard] (aux21) -- (aux25) -- (u55); \draw[-latex,emph] (aux21) -- (aux24) |- (i45);
\node[opnode,circle] () at (aux34) {$\sigma$}; \draw[-latex,emph] (aux21) -- (aux25) -- (u55);
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{tanh}$}; \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle] (i45) at (aux45) {X}; \node[opnode,circle,draw=red,thick] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux35) {$\mathrm{tanh}$};
\node[opnode,circle,draw=red,thick] (i45) at (aux45) {X};
}
\visible<3->{
\node[opnode,circle] (i45) at (aux45) {};
\draw[-latex,standard] (aux21) -- (aux24) |- (i45);
\draw[-latex,standard] (aux21) -- (aux25) -- (u55);
\node[opnode,circle] () at (aux34) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux35) {$\mathrm{tanh}$};
\node[opnode,circle] (i45) at (aux45) {X};
}
% cell update % cell update
\draw[-latex,standard] (aux51) -- (aux59); \visible<3>{
\node[opnode,circle] (f53) at (aux53) {X}; \draw[-latex,emph] (aux51) -- (aux59);
\node[opnode,circle] (u55) at (aux55) {\textbf{+}}; \node[opnode,circle,draw=red,thick] (f53) at (aux53) {X};
\node[opnode,circle,draw=red,thick] (u55) at (aux55) {\textbf{+}};
}
\visible<4->{
\draw[-latex,standard] (aux51) -- (aux59);
\node[opnode,circle] (f53) at (aux53) {X};
\node[opnode,circle] (u55) at (aux55) {\textbf{+}};
}
% output gate % output gate
\node[opnode,circle] (o27) at (aux27) {X}; \visible<4>{
\draw[-latex,standard] (u55) -| (o27); \node[opnode,circle,draw=red,thick] (o27) at (aux27) {X};
\draw[-latex,standard] (aux21) -- (o27); \draw[-latex,emph] (u55) -| (o27);
\node[opnode,circle] () at (aux26) {$\sigma$}; \draw[-latex,emph] (aux21) -- (o27);
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux37) {$\mathrm{tanh}$}; \draw[emph] (aux12) -- (aux22) -- (aux23);
\node[opnode,circle,draw=red,thick] () at (aux26) {$\sigma$};
\draw[-latex,standard] (o27) -- (aux29); \node[opnode,rectangle,rounded corners=2pt,inner sep=2pt,draw=red,thick] () at (aux37) {$\mathrm{tanh}$};
\draw[-latex,standard] (o27) -| (aux68);
\draw[-latex,emph] (o27) -- (aux29);
\draw[-latex,emph] (o27) -| (aux68);
}
\visible<5->{
\node[opnode,circle] (o27) at (aux27) {X};
\draw[-latex,standard] (u55) -| (o27);
\draw[-latex,standard] (aux21) -- (o27);
\node[opnode,circle] () at (aux26) {$\sigma$};
\node[opnode,rectangle,rounded corners=2pt,inner sep=2pt] () at (aux37) {$\mathrm{tanh}$};
\draw[-latex,standard] (o27) -- (aux29);
\draw[-latex,standard] (o27) -| (aux68);
}
\end{scope} \end{scope}
\begin{scope} \begin{scope}
\node[wordnode,anchor=south] () at (aux21) {$h_t$}; \node[wordnode,anchor=south] () at (aux21) {$h_t$};
\node[wordnode,anchor=south] () at (aux51) {$c_t$};
\node[wordnode,anchor=south] () at (aux29) {$h_{t+1}$};
\node[wordnode,anchor=south] () at (aux59) {$c_{t+1}$};
\node[wordnode,anchor=west] () at (aux12) {$x_t$}; \node[wordnode,anchor=west] () at (aux12) {$x_t$};
\node[wordnode,anchor=east] () at (aux68) {$h_{t+1}$}; \node[wordnode,anchor=south] () at (aux51) {$c_t$};
\visible<3->{
\node[wordnode,anchor=south] () at (aux59) {$c_{t+1}$};
}
\visible<4->{
\node[wordnode,anchor=east] () at (aux68) {$h_{t+1}$};
\node[wordnode,anchor=south] () at (aux29) {$h_{t+1}$};
}
\end{scope} \end{scope}
\begin{pgfonlayer}{background} \begin{pgfonlayer}{background}
...@@ -1268,14 +1310,22 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -1268,14 +1310,22 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\end{pgfonlayer} \end{pgfonlayer}
\begin{scope} \begin{scope}
% forget gate formula \visible<1->{
\node[formulanode,anchor=east,text width=3.4cm] () at ([xshift=-0.5\base]aux21) {遗忘门\\$f_t=\sigma(W_f[h_t,x_t]+b_f)$}; % forget gate formula
% input gate formula \node[formulanode,anchor=east,text width=3.4cm] () at ([xshift=-0.5\base]aux21) {遗忘门\\$f_t=\sigma(W_f[h_t,x_t]+b_f)$};
\node[formulanode,anchor=east] () at ([xshift=-0.5\base]aux51) {输入门\\$i_t=\sigma(W_i[h_t,x_t]+b_i)$\\$\hat{c}_t=\mathrm{tanh}(W_c[h_t,x_t]+b_c)$}; }
% cell update formula \visible<2->{
\node[formulanode,anchor=west,text width=3.02cm] () at ([xshift=0.5\base]aux59) {记忆更新\\$c_{t+1}=f_t\cdot c_t+i_t\cdot \hat{c}_t)$}; % input gate formula
% output gate formula \node[formulanode,anchor=east] () at ([xshift=-0.5\base]aux51) {输入门\\$i_t=\sigma(W_i[h_t,x_t]+b_i)$\\$\hat{c}_t=\mathrm{tanh}(W_c[h_t,x_t]+b_c)$};
\node[formulanode,anchor=west] () at ([xshift=0.5\base]aux29) {输出门\\$o_t=\sigma(W_o[h_t,x_t]+b_o)$\\$h_{t+1}=o_t\cdot \mathrm{tanh}(c_{t+1})$}; }
\visible<3->{
% cell update formula
\node[formulanode,anchor=west,text width=3.02cm] () at ([xshift=0.5\base]aux59) {记忆更新\\$c_{t+1}=f_t\cdot c_t+i_t\cdot \hat{c}_t$};
}
\visible<4->{
% output gate formula
\node[formulanode,anchor=west] () at ([xshift=0.5\base]aux29) {输出门\\$o_t=\sigma(W_o[h_t,x_t]+b_o)$\\$h_{t+1}=o_t\cdot \mathrm{tanh}(c_{t+1})$};
}
\end{scope} \end{scope}
\end{tikzpicture} \end{tikzpicture}
\end{center} \end{center}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论