Skip to content

Commit 063ac59

Browse files
committed
update
1 parent 87dff0b commit 063ac59

File tree

2 files changed

+15
-226
lines changed

2 files changed

+15
-226
lines changed
237 KB
Binary file not shown.

doc/src/week47/Latexslides/figslides.tex

Lines changed: 15 additions & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -305,246 +305,35 @@ \section{Variational Autoencoder (VAE)}
305305
Implement with Monte Carlo estimate (often single sample) and backprop through reparameterization.
306306
\end{frame}
307307

308-
\begin{frame}[<+->]{VAE diagram (reveal)}
309-
\centering
310-
\begin{tikzpicture}[>=stealth, node distance=1.8cm]
311-
\node[layer] (x) {Input $x$};
312-
\node[layer, right=1.8cm of x] (enc) {Encoder};
313-
\node[layer, right=1.8cm of enc, yshift=6mm] (mu) {$\mu(x)$};
314-
\node[layer, right=1.8cm of enc, yshift=-6mm] (sigma) {$\sigma(x)$};
315-
\node[layer, right=2.6cm of mu] (z) {$z=\mu+\sigma\odot\epsilon$};
316-
\node[layer, right=2.3cm of z] (dec) {Decoder};
317-
\node[layer, right=1.6cm of dec] (xhat) {$\hat x$};
318-
319-
\draw[->] (x) -- (enc);
320-
\draw[->] (enc) -- (mu);
321-
\draw[->] (enc) -- (sigma);
322-
\draw[->] (mu) -- (z);
323-
\draw[->] (sigma) -- (z);
324-
\draw[->] (z) -- (dec);
325-
\draw[->] (dec) -- (xhat);
326-
327-
\node[right=0.5cm of sigma] (eps) {$\epsilon\sim\mathcal{N}(0,I)$};
328-
\end{tikzpicture}
329-
\end{frame}
330-
331-
332-
\begin{frame}{Unrolled RNN With Weight Matrices}
333-
334-
\begin{tikzpicture}[>=stealth, node distance=2.2cm]
335-
336-
\tikzstyle{node}=[draw, circle, minimum size=10mm]
337-
\tikzstyle{cell}=[draw, rectangle, minimum width=16mm, minimum height=12mm]
338-
339-
% Time step 1
340-
\node[node] (x1) {$x_1$};
341-
\node[cell, above=1.5cm of x1] (h1) {$h_1$};
342-
\node[node, above=1.5cm of h1] (y1) {$y_1$};
343-
344-
% Step 2
345-
\node[node, right=3cm of x1] (x2) {$x_2$};
346-
\node[cell, above=1.5cm of x2] (h2) {$h_2$};
347-
\node[node, above=1.5cm of h2] (y2) {$y_2$};
348-
349-
% Step 3
350-
\node[node, right=3cm of x2] (x3) {$x_3$};
351-
\node[cell, above=1.5cm of x3] (h3) {$h_3$};
352-
\node[node, above=1.5cm of h3] (y3) {$y_3$};
353-
354-
% Arrows input → hidden
355-
\draw[->] (x1) -- node[right] {$W_{xh}$} (h1);
356-
\draw[->] (x2) -- node[right] {$W_{xh}$} (h2);
357-
\draw[->] (x3) -- node[right] {$W_{xh}$} (h3);
358-
359-
% Recurrent arrows
360-
\draw[->] (h1) -- node[above] {$W_{hh}$} (h2);
361-
\draw[->] (h2) -- node[above] {$W_{hh}$} (h3);
362-
363-
% Hidden → output
364-
\draw[->] (h1) -- node[right] {$W_{hy}$} (y1);
365-
\draw[->] (h2) -- node[right] {$W_{hy}$} (y2);
366-
\draw[->] (h3) -- node[right] {$W_{hy}$} (y3);
367-
368-
% Time labels
369-
\node[below=0.2cm of x1] {$t=1$};
370-
\node[below=0.2cm of x2] {$t=2$};
371-
\node[below=0.2cm of x3] {$t=3$};
372-
373-
\end{tikzpicture}
374-
375-
\end{frame}
376-
377-
378-
\begin{frame}{Deep Autoencoder With Bottleneck and Matrices}
379-
380-
\begin{tikzpicture}[>=stealth, node distance=2cm]
381-
382-
\tikzstyle{layer}=[draw, rectangle, minimum width=22mm, minimum height=12mm]
383-
384-
% Input
385-
\node[layer] (x) {Input $x$};
386-
387-
% Encoder layers
388-
\node[layer, right=2cm of x] (enc1) {Enc1 \\ $W_1$};
389-
\node[layer, right=1.7cm of enc1] (enc2) {Enc2 \\ $W_2$};
390-
391-
% Latent
392-
\node[layer, right=1.7cm of enc2, minimum width=16mm] (z) {Latent $z$};
393-
394-
% Decoder
395-
\node[layer, right=1.7cm of z] (dec1) {Dec1 \\ $W_3$};
396-
\node[layer, right=1.7cm of dec1] (dec2) {Dec2 \\ $W_4$};
397-
398-
% Output
399-
\node[layer, right=2cm of dec2] (xhat) {Output $\hat{x}$};
400-
401-
% Arrows
402-
\draw[->] (x) -- (enc1);
403-
\draw[->] (enc1) -- (enc2);
404-
\draw[->] (enc2) -- (z);
405-
\draw[->] (z) -- (dec1);
406-
\draw[->] (dec1) -- (dec2);
407-
\draw[->] (dec2) -- (xhat);
408-
409-
\end{tikzpicture}
410-
411-
\end{frame}
412-
413-
414-
415-
\begin{frame}{LSTM Cell Structure}
416-
417-
\begin{tikzpicture}[>=stealth, node distance=1.8cm]
418-
419-
\tikzstyle{gate}=[draw, rectangle, minimum width=14mm, minimum height=10mm]
420-
\tikzstyle{circlebox}=[draw, circle, minimum size=8mm]
421-
422-
% Input
423-
\node[circlebox] (xt) {$x_t$};
424-
425-
% Gates
426-
\node[gate, above right=0.8cm and 2cm of xt] (i) {Input $i_t$};
427-
\node[gate, above=1.2cm of xt] (f) {Forget $f_t$};
428-
\node[gate, below=1.2cm of xt] (o) {Output $o_t$};
429-
430-
% Cell state
431-
\node[gate, right=3.5cm of xt] (c) {$c_t$};
432-
433-
% Hidden state
434-
\node[circlebox, right=2cm of o] (ht) {$h_t$};
435-
436-
% Arrows
437-
\draw[->] (xt) -- (i);
438-
\draw[->] (xt) -- (f);
439-
\draw[->] (xt) -- (o);
440-
441-
\draw[->] (i) -- (c);
442-
\draw[->] (f) -- (c);
443-
\draw[->] (c) -- (ht);
444-
\draw[->] (o) -- (ht);
445-
446-
\node[above=0.2cm of c] {$c_{t-1}$};
447-
448-
\draw[->] ($(c)+(-1.5,0.7)$) -- (c);
449-
450-
\end{tikzpicture}
451-
452-
\end{frame}
453-
454-
455-
\begin{frame}{CNN Autoencoder}
456-
457-
\begin{tikzpicture}[>=stealth, node distance=2.4cm]
458-
459-
\tikzstyle{block}=[draw, rectangle, minimum width=20mm, minimum height=12mm]
460-
461-
% Input
462-
\node[block] (x) {Input Image};
463-
464-
% Encoder
465-
\node[block, right=2cm of x] (conv1) {Conv};
466-
\node[block, right=1.6cm of conv1] (pool1) {Pool};
467-
\node[block, right=1.6cm of pool1] (conv2) {Conv};
468-
\node[block, right=1.6cm of conv2] (pool2) {Pool};
469-
470-
% Latent
471-
\node[block, right=1.8cm of pool2] (z) {Latent};
472-
473-
% Decoder
474-
\node[block, right=1.8cm of z] (up1) {Upsample};
475-
\node[block, right=1.6cm of up1] (deconv1) {Deconv};
476-
\node[block, right=1.6cm of deconv1] (up2) {Upsample};
477-
\node[block, right=1.6cm of up2] (deconv2) {Deconv};
478-
479-
% Output
480-
\node[block, right=2.2cm of deconv2] (xhat) {Reconstruction};
481-
482-
% Arrows
483-
\draw[->] (x) -- (conv1);
484-
\draw[->] (conv1) -- (pool1);
485-
\draw[->] (pool1) -- (conv2);
486-
\draw[->] (conv2) -- (pool2);
487-
\draw[->] (pool2) -- (z);
488-
489-
\draw[->] (z) -- (up1);
490-
\draw[->] (up1) -- (deconv1);
491-
\draw[->] (deconv1) -- (up2);
492-
\draw[->] (up2) -- (deconv2);
493-
\draw[->] (deconv2) -- (xhat);
494-
495-
\end{tikzpicture}
496-
497-
\end{frame}
498-
499-
500308

501309
\begin{frame}{Variational Autoencoder (VAE)}
502310

503-
\begin{tikzpicture}[>=stealth, node distance=2cm]
504311

505-
\tikzstyle{block}=[draw, rectangle, minimum width=22mm, minimum height=12mm]
506312

507-
% Input
508-
\node[block] (x) {Input $x$};
509313

510-
% Encoder
511-
\node[block, right=2cm of x] (enc) {Encoder};
512314

513-
% Mean & variance
514-
\node[block, right=2cm of enc, yshift=6mm] (mu) {$\mu(x)$};
515-
\node[block, right=2cm of enc, yshift=-6mm] (sigma) {$\sigma(x)$};
516315

517-
% Latent z
518-
\node[block, right=3cm of mu] (z) {$z = \mu + \sigma \odot \epsilon$};
519316

520-
% Decoder
521-
\node[block, right=3cm of z] (dec) {Decoder};
522317

523-
% Output
524-
\node[block, right=2.2cm of dec] (xhat) {$\hat{x}$};
525-
526-
% Arrows
527-
\draw[->] (x) -- (enc);
528-
\draw[->] (enc) -- (mu);
529-
\draw[->] (enc) -- (sigma);
530-
531-
\draw[->] (mu) -- (z);
532-
\draw[->] (sigma) -- (z);
533-
534-
\draw[->] (z) -- (dec);
535-
\draw[->] (dec) -- (xhat);
536-
537-
% Noise input
538-
\node[right=0.3cm of sigma] (epslabel) {$\epsilon \sim \mathcal{N}(0,I)$};
539318

319+
\begin{tikzpicture}[>=latex, thick, every node/.style={draw,circle,fill=white,minimum size=6mm}]
320+
% Input and hidden state nodes (t=1..6)
321+
\foreach \i in {0,...,5}{
322+
\pgfmathtruncatemacro{\num}{\i+1}
323+
\node (x\num) at ({2*\i},0) {$x_{\num}$};
324+
\node (h\num) at ({2*\i},2) {$h_{\num}$};
325+
}
326+
% Arrows: input-to-hidden (W_{xh})
327+
\foreach \i in {1,...,6}{
328+
\draw[->] (x\i.north) -- node[midway,right] {$W_{xh}$} (h\i.south);
329+
}
330+
% Arrows: hidden-to-hidden (W_{hh})
331+
\foreach \i/\j in {1/2,2/3,3/4,4/5,5/6}{
332+
\draw[->] (h\i.east) -- node[midway,above] {$W_{hh}$} (h\j.west);
333+
}
540334
\end{tikzpicture}
541335

542336
\end{frame}
543-
544-
545-
546-
547-
548337
\end{document}
549338

550339

0 commit comments

Comments
 (0)