Commit f1ce4cd8 by Lee

Update LSTM figure

parent 9c3891b4
......@@ -1155,14 +1155,16 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\end{itemize}
%%% 图
\begin{center}
\hspace*{-0.9cm}
\begin{tikzpicture}
\setlength{\base}{1cm}
\setlength{\base}{0.6cm}
\tikzstyle{wordnode} = [font=\normalsize,align=left]
\tikzstyle{wordnode} = [font=\scriptsize]
\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,fill=white,font=\normalsize]
\tikzstyle{standard} = [rounded corners=5pt]
\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{emph} = [rounded corners=5pt,very thick,draw=red]
\tikzstyle{formulanode} = [font=\scriptsize,align=left,draw=red,rectangle,fill=red!30!white,rounded corners=2pt,drop shadow]
% Skeleton
\begin{scope}[every label/.append style={label distance=1pt,font=\tiny,inner sep=0pt,opacity=0}]
......@@ -1224,40 +1226,57 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\end{scope}
\begin{scope}
\node[opnode] (f53) at (aux53) {$\bigotimes$};
\node[opnode] (u55) at (aux55) {$\bigoplus$};
\node[opnode,circle] (f53) at (aux53) {};
\node[opnode,circle] (u55) at (aux55) {};
% forget gate
\draw[standard] (aux21) -- (aux23) -- (aux33);
\draw[-latex,standard] (aux12) -- (aux22) -- (aux23) -- (f53);
\node[opnode] () at (aux33) {$\bigodot$};
\node[opnode,circle] () at (aux33) {$\sigma$};
% input gate
\node[opnode] (i45) at (aux45) {$\bigotimes$};
\node[opnode,circle] (i45) at (aux45) {};
\draw[-latex,standard] (aux21) -- (aux24) |- (i45);
\draw[-latex,standard] (aux21) -- (aux25) -- (u55);
\node[opnode] () at (aux34) {$\bigodot$};
\node[opnode,draw,rectangle,rounded corners=2pt,inner sep=3pt,font=\small] () at (aux35) {$\mathrm{tanh}$};
\node[opnode] (i45) at (aux45) {$\bigotimes$};
\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
\draw[-latex,standard] (aux51) -- (aux59);
\node[opnode] (f53) at (aux53) {$\bigotimes$};
\node[opnode] (u55) at (aux55) {$\bigoplus$};
\node[opnode,circle] (f53) at (aux53) {X};
\node[opnode,circle] (u55) at (aux55) {\textbf{+}};
% output gate
\node[opnode] (o27) at (aux27) {$\bigotimes$};
\node[opnode,circle] (o27) at (aux27) {X};
\draw[-latex,standard] (u55) -| (o27);
\draw[-latex,standard] (aux21) -- (o27);
\node[opnode] () at (aux26) {$\bigodot$};
\node[opnode,draw,rectangle,rounded corners=2pt,inner sep=3pt,font=\small] () at (aux37) {$\mathrm{tanh}$};
\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}
\node[wordnode,anchor=south west] () at (aux21) {$h_t$};
\node[wordnode,anchor=south west] () at (aux51) {$c_t$};
\node[wordnode,anchor=south east] () at (aux29) {$h_{t+1}$};
\node[wordnode,anchor=south east] () at (aux59) {$c_{t+1}$};
\node[wordnode,anchor=south west] () at (aux12) {$x_t$};
\node[wordnode,anchor=north east] () at (aux68) {$h_{t+1}$};
\begin{scope}
\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=east] () at (aux68) {$h_{t+1}$};
\end{scope}
\begin{pgfonlayer}{background}
\node[draw,very thick,rectangle,fill=blue!30!white,rounded corners=5pt,inner sep=4pt,fit=(aux22) (aux58) (u55) (o27)] (LSTM) {};
\end{pgfonlayer}
\begin{scope}
% forget 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)$};
% input 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)$};
% 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)$};
% 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{tikzpicture}
\end{center}
\end{frame}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论