Last active
November 14, 2017 14:43
-
-
Save moskomule/743bd586db9b3e81beeeab83fb7aec83 to your computer and use it in GitHub Desktop.
tikz scripts for NN description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture}[->,>=stealth,shorten >=1pt,auto,node distance=2cm, | |
semithick, | |
val/.style={circle,fill=cyan,opacity=.6}] | |
\node[val] (a) {$1$}; | |
\node[right=0.1cm of a] (a1) {$u_{1}$}; | |
\node[above=0.1cm of a] (b) {$l$}; | |
\node[below=0.3cm of a] (c) {$\vdots$}; | |
\node[val, below=0.3cm of c] (d) {$i$}; | |
\node[below=0.3cm of d] (d2) {$\vdots$}; | |
\node[right=0.1cm of d] (d1) {$u_{i}$}; | |
\node[right=of a] (e0) {}; | |
\node[below=0.5cm of e0] (e) {$s_{j}$}; | |
\node[above left=0.1cm of e] (e1) {$\hat{u}_{j|1}$}; | |
\node[below left=0.1cm of e] (e2) {$\hat{u}_{j|i}$}; | |
\node[val, right=0.5cm of e] (f) {$j$}; | |
\node[above=0.1cm of f] (g) {$l+1$}; | |
\node[right=0.5cm of f] (h) {}; | |
\node[below right=0.1cm of f] (f1) {$v_{j}$}; | |
\path | |
(a) edge (e) | |
(e) edge (f) | |
(d) edge (e) | |
(f) edge (h) | |
; | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture}[->,>=stealth,shorten >=1pt,auto,node distance=1cm, | |
semithick, | |
val/.style={circle,fill=cyan,opacity=.6}, | |
op/.style={circle,fill=gray,opacity=.5}] | |
\node[val] (i1) {$h^{l-1}$}; | |
\node[op, above right =of i1] (i) {$f$}; | |
\node[op,above left =of i] (i2) {$+$}; | |
\node[val,above=of i2] (i3) {$h^{l}$}; | |
\path | |
(i1) edge [bend right](i) | |
(i) edge [bend right] (i2) | |
(i1) edge [bend left] (i2) | |
(i2) edge (i3) | |
; | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture} | |
\tikzset{cell/.style={circle,fill=cyan,opacity=.5, node distance=1cm}}; | |
\tikzset{val/.style={rectangle,fill=red,opacity=.3, node distance=1cm}}; | |
\node[val] (a) {$1$}; | |
\node[val,right=of a] (b) {$2$}; | |
\node[val,right=of b] (c) {$3$}; | |
\node[val,right=of c] (d) {$+$}; | |
\node[val,right=of d] (e) {$2$}; | |
\node[val,right=of e] (f) {$3$}; | |
\node[val,right=of f] (g) {$4$}; | |
\node[cell,above=of a] (a1) {{\small cell}}; | |
\node[cell,left=of a1] (a0) {{\small init}}; | |
\node[cell,above=of b] (b1) {{\small cell}}; | |
\node[cell,above=of c] (c1) {{\small cell}}; | |
\node[cell,above=of d] (d1) {{\small cell}}; | |
\node[cell,above=of e] (e1) {{\small cell}}; | |
\node[cell,above=of f] (f1) {{\small cell}}; | |
\node[cell,above=of g] (g1) {{\small cell}}; | |
\node[cell,above=of g1] (c2) {}; | |
\node[cell,left=of c2] (b2) {}; | |
\node[cell,left=of b2] (a2) {}; | |
\node[cell,right=of c2] (d2) {}; | |
\node[val, above=of a2] (a3) {`` ''}; | |
\node[val, above=of b2] (b3) {$3$}; | |
\node[val, above=of c2] (c3) {$5$}; | |
\node[val, above=of d2] (d3) {$7$}; | |
\node[above left=0.5cm of a] (a5) {}; | |
\node[below right=0.5cm of g] (g5) {}; | |
\draw[fill=yellow,opacity=0.3] (a5) rectangle (g5); | |
\node[above left=0.5cm of a1] (a4) {}; | |
\node[below right=0.5cm of g1] (g4) {}; | |
\draw[fill=green,opacity=0.3] (a4) rectangle (g4); | |
\path (a) edge [-> ] (a1) | |
(b) edge [-> ] (b1) | |
(c) edge [-> ] (c1) | |
(d) edge [-> ] (d1) | |
(e) edge [-> ] (e1) | |
(f) edge [-> ] (f1) | |
(g) edge [-> ] (g1); | |
\path (a0) edge [-> ] (a1) | |
(a1) edge [-> ] (b1) | |
(b1) edge [-> ] (c1) | |
(c1) edge [-> ] (d1) | |
(d1) edge [-> ] (e1) | |
(e1) edge [-> ] (f1) | |
(f1) edge [-> ] (g1); | |
\path (g1) edge [-> ] (a2) | |
(g1) edge [-> ] (b2) | |
(g1) edge [-> ] (c2) | |
(g1) edge [-> ] (d2); | |
\path (a2) edge (a3) | |
(b2) edge (b3) | |
(c2) edge (c3) | |
(d2) edge (d3); | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture} | |
\tikzset{cell/.style={circle,fill=cyan,opacity=.5, node distance=0.8cm, text centered, minimum height=0.6cm}}; | |
\tikzset{val/.style={circle,fill=blue,opacity=.5, node distance=0.8cm, text centered, minimum height=0.6cm}}; | |
%%%%% encoder | |
% 1st layer | |
\node[val] (e0) {$e0$}; | |
\node[val, right=of e0] (e1) {$e1$}; | |
\node[val,right=3cm of e1] (en) {$e_N$}; | |
% 2nd layer | |
\node[cell, above=of e0] (c0) {}; | |
\node[cell, above=of e1] (c1) {}; | |
\node[val, left=of c0] (eta-1) {$\eta_{-1}$}; | |
\node[cell,above=of en] (cn) {}; | |
% 3rd layer | |
\node[val, above=of c0] (eta0) {$\eta_0$}; | |
\node[val, above=of c1] (eta1) {$\eta_1$}; | |
\node[val, above=of cn] (etan) {$\eta_N$}; | |
\node[left=of eta0] (H) {$H$}; | |
%%%%%% rectangles | |
\node[above left=0.3cm of c0] (c00) {}; | |
\node[below right=0.3cm of cn] (cn0) {}; | |
\draw[dashed] (c00) rectangle (cn0); | |
\node[above left=0.3cm of eta0] (eta00) {}; | |
\node[below right=0.3cm of etan] (etan0) {}; | |
\draw[dashed] (eta00) rectangle (etan0); | |
%%%%%% paths | |
\path (e0) edge [->] (c0) | |
(e1) edge [->] (c1) | |
(en) edge [->] (cn) | |
(eta-1) edge [->] (c0) | |
(c0) edge [->] (c1) | |
(c1) edge [->, dashed] (cn) | |
(c0) edge [->] (eta0) | |
(c1) edge [->] (eta1) | |
(cn) edge [->] (etan); | |
%%%%% decoder | |
\node[right=of cn] (joint) {}; | |
% 2nd layer | |
\node[cell, right=of joint] (C0) {}; | |
\node[cell, right=of C0] (C1) {}; | |
\node[right=3cm of C1] (Cn) {}; | |
% 1st layer | |
\node[below=of C0] (rc0) {$(r_0,c_0)$}; | |
\node[below=of C1] (rc1) {$(r_1,c_1)$}; | |
\node[right=0.5cm of rc1] (rc2) {}; | |
% 3rd layer | |
\node[val, above=of C0] (h0) {$h_0$}; | |
\node[val, above=of C1] (h1) {$h_1$}; | |
%%%%%% rectangles | |
\node[above left=0.3cm of C0] (C00) {}; | |
\node[below right=0.3cm of Cn] (Cn0) {}; | |
\draw[dashed] (C00) rectangle (Cn0); | |
\node[above left=0.3cm of eta0] (eta00) {}; | |
\node[below right=0.3cm of etan] (etan0) {}; | |
\draw[dashed] (eta00) rectangle (etan0); | |
%%%%%% paths | |
\path (rc0) edge [->] (C0) | |
(rc1) edge [->] (C1) | |
(cn) edge [->] (C0) | |
(C0) edge [->] (C1) | |
(C1) edge [->, dashed] (Cn) | |
(C0) edge [->] (h0) | |
(C1) edge [->] (h1) | |
(h0) edge [->, out=0,in=180] (rc1) | |
(h1) edge [->, out=0,in=180] (rc2); | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture} | |
\fill [orange, opacity=.5] (0,3) rectangle (3,6); | |
\fill [orange, opacity=.5] (1,-1) rectangle (2,-2); | |
\draw [very thin] (0, 6) -- (1, -1); | |
\draw [very thin] (0, 3) -- (1, -2); | |
\draw [very thin] (3, 6) -- (2, -1); | |
\draw [very thin] (3, 3) -- (2, -2); | |
\draw [help lines] (1,-1) grid (5,-5); | |
\draw [help lines] (0,0) grid (6,6); | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture} | |
\draw [help lines] (0,0) grid (3,3); | |
\draw [help lines] (7,3) grid (4,0); | |
\fill [orange, opacity=.5] (7,3) rectangle (4,0); | |
\node (a) at (0.5,2.5) {$a$}; | |
\node (b) at (1.5,2.5) {$b$}; | |
\node (c) at (2.5,2.5) {$c$}; | |
\node (d) at (0.5,1.5) {$d$}; | |
\node (e) at (1.5,1.5) {$e$}; | |
\node (f) at (2.5,1.5) {$f$}; | |
\node (g) at (0.5,0.5) {$g$}; | |
\node (h) at (1.5,0.5) {$h$}; | |
\node (i) at (2.5,0.5) {$i$}; | |
\node (r) at (4.5,2.5) {$r$}; | |
\node (s) at (5.5,2.5) {$s$}; | |
\node (t) at (6.5,2.5) {$t$}; | |
\node (u) at (4.5,1.5) {$u$}; | |
\node (v) at (5.5,1.5) {$v$}; | |
\node (w) at (6.5,1.5) {$w$}; | |
\node (x) at (4.5,0.5) {$x$}; | |
\node (y) at (5.5,0.5) {$y$}; | |
\node (z) at (6.5,0.5) {$z$}; | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=1cm, | |
semithick, every node/.style={circle,fill=cyan,opacity=.2}, | |
now/.style={circle,fill=cyan,opacity=.6}] | |
\node[] (i1) {$x_0$}; | |
\node[above=of i1] (a1) {$h^{1}_0$}; | |
\node[above=of a1] (b1) {$h^{2}_0$}; | |
\node[left=of a1] (a0) {$h^{1}_{-1}$}; | |
\node[left=of b1] (b0) {$h^{2}_{-1}$}; | |
\node[above=of b1] (o1) {$y_0$}; | |
\node[right=of i1] (i2) {$x_1$}; | |
\node[above=of i2] (a2) {$h^{1}_1$}; | |
\node[above=of a2] (b2) {$h^{2}_1$}; | |
\node[above=of b2] (o2) {$y_1$}; | |
\node[right=of i2] (i3) {$x_2$}; | |
\node[above=of i3] (a3) {$h^{1}_2$}; | |
\node[above=of a3] (b3) {$h^{2}_2$}; | |
\node[above=of b3] (o3) {$y_2$}; | |
\path | |
(i1) edge (a1) | |
(a1) edge (b1) | |
(a0) edge (a1) | |
(b0) edge (b1) | |
(b1) edge (o1) | |
(i2) edge (a2) | |
(a2) edge (b2) | |
(a1) edge (a2) | |
(b1) edge (b2) | |
(b2) edge (o2) | |
(i3) edge (a3) | |
(a3) edge (b3) | |
(a2) edge (a3) | |
(b2) edge (b3) | |
(b3) edge (o3) | |
; | |
\end{tikzpicture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tikzpicture} | |
\tikzset{cell/.style={circle,fill=cyan,opacity=.5, node distance=0.8cm, text centered, minimum height=0.6cm}}; | |
\tikzset{val/.style={circle,fill=blue,opacity=.5, node distance=0.8cm, text centered, minimum height=0.6cm}}; | |
%%%%% encoder | |
% 1st layer | |
\node[] (e0) {$1$}; | |
\node[right=of e0] (e1) {$0$}; | |
\node[right= of e1] (en) {$1$}; | |
% 2nd layer | |
\node[cell, above=of e0] (c0) {}; | |
\node[cell, above=of e1] (c1) {}; | |
\node[cell,above=of en] (cn) {}; | |
%%%%%% rectangles | |
\node[above left=0.3cm of c0] (c00) {}; | |
\node[below right=0.3cm of cn] (cn0) {}; | |
\draw[dashed] (c00) rectangle (cn0); | |
%%%%%% paths | |
\path (e0) edge [->] (c0) | |
(e1) edge [->] (c1) | |
(en) edge [->] (cn) | |
(c0) edge [->] (c1) | |
(c1) edge [->] (cn); | |
%%%%% decoder | |
\node[right=of cn] (joint) {}; | |
% 2nd layer | |
\node[cell, right=of joint] (C0) {}; | |
\node[cell, right=of C0] (C1) {}; | |
\node[cell, right= of C1] (Cn) {}; | |
% 1st layer | |
\node[below=of C0] (rc0) {<B>}; | |
\node[below=of C1] (rc1) {百}; | |
\node[below=of Cn] (rcn) {一}; | |
% 3rd layer | |
\node[above=of C0] (h0) {$百$}; | |
\node[above=of C1] (h1) {$一$}; | |
\node[above=of Cn] (hn) {$<E>$}; | |
%%%%%% rectangles | |
\node[above left=0.3cm of C0] (C00) {}; | |
\node[below right=0.3cm of Cn] (Cn0) {}; | |
\draw[dashed] (C00) rectangle (Cn0); | |
%%%%%% paths | |
\path (rc0) edge [->] (C0) | |
(rc1) edge [->] (C1) | |
(rcn) edge [->] (Cn) | |
(cn) edge [->] (C0) | |
(C0) edge [->] (C1) | |
(C1) edge [->] (Cn) | |
(C0) edge [->] (h0) | |
(C1) edge [->] (h1) | |
(Cn) edge [->] (hn) | |
(h0) edge [->, out=0,in=180] (rc1) | |
(h1) edge [->, out=0,in=180] (rcn); | |
\end{tikzpicture} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment