fig-back-propagation-hid.tex 2.17 KB
Newer Older
孟霞 committed
1 2 3
%%%------------------------------------------------------------------------------------------------------------
\begin{tikzpicture}
\begin{scope}
孟霞 committed
4 5 6
\node [anchor=center,draw,fill=red!20,minimum height=1.8em,minimum width=2.5em] (h) at (0,0) {${\bm h}^{k-1}$};
\node [anchor=west,draw,fill=blue!20,minimum height=1.8em,minimum width=2.5em] (s) at ([xshift=6em]h.east) {${\bm s}^{k}$};
\node [anchor=west,draw,fill=green!20,minimum height=1.8em,minimum width=2.5em] (h2) at ([xshift=6em]s.east) {${\bm h}^{k}$};
孟霞 committed
7 8 9
\node [anchor=east] (prev) at ([xshift=-2em]h.west) {...};
\node [anchor=west] (next) at ([xshift=2em]h2.east) {...};
\draw [->,thick] ([xshift=0.1em]prev.east) -- ([xshift=-0.1em]h.west);
孟霞 committed
10 11
\draw [->,thick] ([xshift=0.1em]h.east) -- ([xshift=-0.1em]s.west) node [pos=0.5,below] {\scriptsize{${\bm s}^k = {\bm h}^{k-1}{\bm W}^k$}};
\draw [->,thick] ([xshift=0.1em]s.east) -- ([xshift=-0.1em]h2.west) node [pos=0.5,below] {\scriptsize{${\bm h}^k = f^k({\bm s}^{k})$}};
孟霞 committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
\draw [->,thick] ([xshift=0.1em]h2.east) -- ([xshift=-0.1em]next.west);

{
\draw [<-,thick,red] ([xshift=0.1em,yshift=0.4em]h2.east) -- ([xshift=-0.1em,yshift=0.4em]next.west) node [pos=0.8,above] {\scriptsize{反向传播}};
}

{
\draw [<-,thick,red] ([xshift=0.1em,yshift=0.4em]s.east) -- ([xshift=-0.1em,yshift=0.4em]h2.west) node [pos=0.5,above] {\scriptsize{反向传播}};
}

{
\draw [<-,thick,red] ([xshift=0.1em,yshift=0.4em]h.east) -- ([xshift=-0.1em,yshift=0.4em]s.west) node [pos=0.5,above] {\scriptsize{反向传播}};
}

{
\draw [->,thick,red,dashed] ([yshift=-0.1em]h.south) -- ([yshift=-1em]h.south) -- ([yshift=-1em]h2.south) -- ([yshift=-0.1em]h2.south);
\node [anchor=north,red] (recur) at ([yshift=-1em]s.south) {\scriptsize{$k=k-1$重复上述过程}};
}

{
孟霞 committed
32
\node [anchor=south] (h2label) at (h2.north) {$\frac{\partial L}{\partial {\bm h}^{k}}$};
孟霞 committed
33 34 35
}

{
孟霞 committed
36
\node [anchor=south] (slabel) at (s.north) {$\frac{\partial L}{\partial {\bm s}^{k}}$};
孟霞 committed
37 38 39
}

{
孟霞 committed
40
\node [anchor=south] (hlabel) at (h.north) {$\frac{\partial L}{\partial {\bm h}^{k-1}}$, $\frac{\partial L}{\partial {\bm W}^{k}}$};
孟霞 committed
41 42 43 44 45 46
}

\end{scope}
\end{tikzpicture}
%%%------------------------------------------------------------------------------------------------------------