Skip to content

Commit 69fb2a5

Browse files
committed
initial commit
1 parent d0aad2f commit 69fb2a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2224
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.aux
2+
*.log
3+
*.pdf
4+
*.synctex.gz
5+
*.png
6+
*.jpg

activation_leakyrelu.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
% Leaky ReLU
2+
\begin{tikzpicture}[]
3+
\begin{axis}[
4+
%title=$\tanh(x)$,
5+
axis x line=middle, xmin=-4, xmax=4, xtick={-3,...,3}, xlabel=$x$,
6+
axis y line=middle, ymin=-2, ymax=2, ytick={-1,...,1}, ylabel=$f(x)$,
7+
legend pos=north west,
8+
legend style={empty legend, draw=none},
9+
scale only axis=true,
10+
width=8cm, height=4cm,
11+
thick,
12+
samples=101]
13+
\addplot[blue, very thick] {(\x < 0) * (0.3 * \x) + (\x > 0) * (\x)};
14+
%\addlegendentry{$\tanh(x)$}
15+
\end{axis}
16+
\end{tikzpicture}

activation_relu.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
% ReLU
2+
\begin{tikzpicture}[]
3+
\begin{axis}[
4+
%title=$\tanh(x)$,
5+
axis x line=middle, xmin=-4, xmax=4, xtick={-3,...,3}, xlabel=$x$,
6+
axis y line=middle, ymin=-2, ymax=2, ytick={-1,...,1}, ylabel=$f(x)$,
7+
legend pos=north west,
8+
legend style={empty legend, draw=none},
9+
scale only axis=true,
10+
width=8cm, height=4cm,
11+
thick,
12+
samples=101]
13+
\addplot[blue, very thick] {(\x < 0) * (0) + (\x > 0) * (\x)};
14+
%\addlegendentry{$\tanh(x)$}
15+
\end{axis}
16+
\end{tikzpicture}

activation_sigmoid.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
% sigmoid
2+
\begin{tikzpicture}[]
3+
\begin{axis}[
4+
%title=$\tanh(x)$,
5+
axis x line=middle, xmin=-4, xmax=4, xtick={-3,...,3}, xlabel=$x$,
6+
axis y line=middle, ymin=-2, ymax=2, ytick={-1,...,1}, ylabel=$f(x)$,
7+
legend pos=north west,
8+
legend style={empty legend, draw=none},
9+
scale only axis=true,
10+
width=8cm, height=4cm,
11+
thick,
12+
samples=101]
13+
\addplot[blue, very thick] {1/(1+exp(-x))};
14+
%\addlegendentry{$\tanh(x)$}
15+
\end{axis}
16+
\end{tikzpicture}

activation_tanh.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
% tanh
2+
\begin{tikzpicture}[]
3+
\begin{axis}[
4+
%title=$\tanh(x)$,
5+
axis x line=middle, xmin=-4, xmax=4, xtick={-3,...,3}, xlabel=$x$,
6+
axis y line=middle, ymin=-2, ymax=2, ytick={-1,...,1}, ylabel=$f(x)$,
7+
legend pos=north west,
8+
legend style={empty legend, draw=none},
9+
scale only axis=true,
10+
width=8cm, height=4cm,
11+
thick,
12+
samples=101]
13+
\addplot[blue, very thick] {tanh(x))};
14+
%\addlegendentry{$\tanh(x)$}
15+
\end{axis}
16+
\end{tikzpicture}

block_dense.tex

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
% Dense Block
2+
3+
\begin{tikzpicture}[thick, node distance=\vlayerheight, on grid]
4+
5+
\coordinate (labelcoord) at (\vlayerwidth/2-2pt, 6pt);
6+
7+
\coordinate (n0) at (0,0);
8+
\coordinate (n1) at ($(n0) +(0pt, -4pt)$);
9+
\node[anchor=north west] at ($(n1) +(-2pt, 6pt)$) {\tiny wxhxc};
10+
11+
\foreach \y in {1,...,8} {
12+
\begin{scope} [start chain=going below, every node/.style={on chain}]
13+
\node[bn, vlayer] (n3) at ($(n1) +(0.8*\vlayerwidth, -20pt)$) {};
14+
\node[activation, vlayer] {};
15+
\node[conv, vlayer] (n4) {};
16+
\node[bn, vlayer] {};
17+
\node[activation, vlayer] {};
18+
\node[conv, vlayer] (n2) {};
19+
\end{scope}
20+
21+
\node[anchor=north west] at ($(n4) +(labelcoord)$) {\tiny 1,1,4k};
22+
\node[anchor=north west] at ($(n2) +(labelcoord)$) {\tiny 3,1,k};
23+
\draw[signal] (n1) |- +(8pt, -8pt) -| (n3);
24+
\coordinate (n1) at ($(n2) +(-0.8*\vlayerwidth, -16pt)$);
25+
\draw[signal, -] (n2) |- +(-8pt, -8pt) -| (n1);
26+
\node[anchor=north west] at ($(n1) +(-2pt, 6pt)$) {\tiny wxhx(c+\y k)};
27+
}
28+
29+
\draw[signal] (n0) -- ($(n1) +(0pt, -12pt)$);
30+
31+
\end{tikzpicture}

block_inception.tex

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
% Inception Block
2+
3+
\begin{tikzpicture}[start chain=main going below, node distance=12pt,
4+
point/.append style={on chain, join=by {signal}},
5+
layer/.append style={on chain, join=by {signal}},
6+
branch/.append style={on chain, join=by {signal, -}},
7+
]
8+
\def\branchy{70pt}
9+
10+
\node[point] {Input};
11+
\node[branch] {};
12+
{[start branch=b1 going below]
13+
\node[conv, xshift=-\layerwidth*1.5-24pt, yshift=-\branchy-26pt] {Conv 1x1};
14+
\node[activation] {ReLU};
15+
}
16+
{[start branch=b2 going below]
17+
\node[conv, xshift=-\layerwidth*0.5-8pt, yshift=-\branchy] {Conv 1x1};
18+
\node[activation] {ReLU};
19+
\node[conv] {Conv 3x3};
20+
\node[activation] {ReLU};
21+
}
22+
{[start branch=b3 going below]
23+
\node[conv, xshift=\layerwidth*0.5+8pt, yshift=-\branchy] {Conv 1x1};
24+
\node[activation] {ReLU};
25+
\node[conv] (foo) {Conv 5x5};
26+
\node[activation] {ReLU};
27+
}
28+
\node[pool, xshift=\layerwidth*1.5+24pt, yshift=-\branchy-13pt] {MaxPool 3x3};
29+
\node[conv] {Conv 1x1};
30+
\node[activation] {ReLU};
31+
\node[layer, xshift=-\layerwidth*1.5-24pt, yshift=-\branchy,
32+
join=with main/b1-end by signal,
33+
join=with main/b2-end by signal,
34+
join=with main/b3-end by signal] {Concatenation};
35+
\node[point] {Output};
36+
\end{tikzpicture}

block_residual.tex

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
% Residual Block
2+
3+
\begin{tikzpicture}[start chain=going below, node distance=12pt,
4+
point/.append style={on chain, join=by {signal}},
5+
layer/.append style={on chain, join=by {signal}},
6+
branch/.append style={on chain, join=by {signal, -}},
7+
]
8+
\def\branchy{30pt}
9+
10+
\node[point] {Input};
11+
\node[branch] (input) {};
12+
\node[conv, xshift=\layerwidth/2+16pt, yshift=-\branchy] {Conv};
13+
\node[bn] {BatchNorm};
14+
\node[activation] {ReLU};
15+
\node[conv] {Conv};
16+
\node[bn] {BatchNorm};
17+
\node[layer, xshift=-\layerwidth/2-16pt, yshift=-\branchy] (add) {Addition};
18+
\node[activation] {ReLU};
19+
\node[point] {Output};
20+
\draw[signal] (input) -- (add);
21+
\end{tikzpicture}

block_residual2.tex

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
% Residual Block 2
2+
3+
\begin{tikzpicture}[start chain=going below, node distance=12pt,
4+
point/.append style={on chain, join=by {signal}},
5+
layer/.append style={on chain, join=by {signal}},
6+
branch/.append style={on chain, join=by {signal, -}},
7+
]
8+
\def\branchy{30pt}
9+
10+
\node[point] {Input};
11+
\node[branch] (input) {};
12+
\node[bn, xshift=\layerwidth/2+16pt, yshift=-\branchy] {BatchNorm};
13+
\node[activation] {ReLU};
14+
\node[conv] {Conv};
15+
\node[bn] {BatchNorm};
16+
\node[activation] {ReLU};
17+
\node[conv] {Conv};
18+
\node[layer, xshift=-\layerwidth/2-16pt, yshift=-\branchy] (add) {Addition};
19+
\node[point] {Output};
20+
\draw[signal] (input) -- (add);
21+
\end{tikzpicture}

cell_gru.tex

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
% GRU
2+
\begin{tikzpicture}[thick, node distance=30pt and 30pt, on grid]
3+
\node[cell, minimum width=200pt, minimum height=110pt, anchor=north west] (b) at (-2pt,0pt) {};
4+
5+
\coordinate (hin) at (0pt,-20pt);
6+
\draw[signal] (hin) +(-\iolen, 0pt) node[above] {$h_{t-1}$} -- (hin);
7+
\coordinate (hout) at (200pt,-20pt);
8+
\draw[signal] (hout) -- +(\iolen,0pt) node[above left] {$h_{t}$};
9+
\coordinate (h) at (184pt,0pt);
10+
\draw[signal] (h) -- +(0,\iolen) node[left] {$h_{t}$};
11+
\coordinate (x) at (14pt,-110pt);
12+
\draw[signal, -] (x) +(0pt,-\iolen) node[left] {$x_{t}$} -- (x);
13+
14+
\node[celllayer] (r) at (68pt,-80pt) {$\sigm$};
15+
\node[celllayer, right=58pt of r] (z) {$\sigm$};
16+
\node[celllayer, right=34pt of z] (ht) {$\tanh$};
17+
18+
\node[pointwise, above=30pt of ht] (htm) {$\times$};
19+
\draw[signal] (ht) edge node[pos=0.5,left] {$\tilde{h}_t$} (htm);
20+
\node[pointwise, above=30pt of htm] (htmp) {$+$};
21+
\draw[signal] (htm) -- (htmp);
22+
\draw[signal, -] (htmp) -- (hout);
23+
24+
\node[pointwise, above left=30pt and 30pt of z] (z1) {$-1$};
25+
\draw[signal] (z) |- (z1) node[pos=0.2,left] {$z_t$};
26+
\node[pointwise, above=30pt of z1] (z1m) {$\times$};
27+
\draw[signal] (z1) -- (z1m);
28+
\draw[signal, -] (z1m) -- (htmp);
29+
\draw[signal] (z) |- (htm);
30+
\draw[signal, -] (hout -| h) +(-10pt,0pt) -| (h);
31+
32+
\draw[signal, -] (hin) +(-10pt,0pt) -- (z1m);
33+
34+
\node[pointwise, above left=30pt and 30pt of r] (rm) {$\times$};
35+
\draw[signal] (r) |- (rm) node[pos=0.2,left] {$r_t$};
36+
\draw[signal] (hin -| rm) +(-10pt,0pt) -| (rm);
37+
38+
\coordinate (hx) at (60pt,-94pt);
39+
\draw[signal, -] (x) |- (hx);
40+
\draw[signal, -] (hin) +(-10pt,0pt) -| (x |- r) |- (hx) +(10pt,0pt);
41+
\draw[signal, -] (hx) -| (r);
42+
\draw[signal, -] (hx) -| (z);
43+
44+
\coordinate (rx) at (60pt,-102pt);
45+
\draw[signal, -] (x) |- (rx);
46+
\draw[signal, -] (rx) -| (ht);
47+
48+
\draw[signal, -, shorten >=\intergape] (rm) |- (rm |- hx);
49+
\draw[signal, -, shorten <=\intergape] (rm |- hx) |- (z |- rx);
50+
\end{tikzpicture}

0 commit comments

Comments
 (0)