PhD

The LaTeX sources of my Ph.D. thesis
git clone https://esimon.eu/repos/PhD.git
Log | Files | Refs | README | LICENSE

bert.tex (2093B)


      1 \begin{tikzpicture}
      2 	\path[clip] (-1.15, -2.5) -- (-1.15, 4.5) -- (3.8, 4.5) -- (3.8, -2.5) -- cycle;
      3 	\foreach \I/\n/\x/\focus in {1/1/-0.85/\transparencyLow, m2/./0/\transparencyLow, m1/t-1/0.85/\transparencyLow, p1/./2.55/\transparencyLow, m/m/3.40/\transparencyLow, 0/t/1.7/1}{
      4 		\if.\n
      5 			\node (w\I) at (\x,  4) {\(\cdots\)\vphantom{\(\hat{w}_{\n}\)}};
      6 			\node (x\I) at (\x, -2) {\(\cdots\)\vphantom{\(\vctr{\tilde{x}}_{\n}\)}};
      7 		\else
      8 			\node (w\I) at (\x,  4) {\(\hat{w}_{\n}\)};
      9 			\node (x\I) at (\x, -2) {\(\vctr{\tilde{x}}_{\n}\)};
     10 		\fi
     11 
     12 		\pgfmathsetmacro\xmn{\x-1.25}
     13 		\memorynetwork[\focus]{(\xmn,-0.3)}{\I};
     14 
     15 		\begin{scope}[opacity=\focus]
     16 			\node[draw, fill=white, above=6mm of o\I]   (lnf\I) {Layer Norm};
     17 			\node[draw, fill=white, above=4mm of lnf\I] (lin\I) {Linear};
     18 			\node[draw, fill=white, above=4mm of lin\I] (lns\I) {Layer Norm};
     19 
     20 			\coordinate (ressrc\I) at ($(lin\I.south) + (0, -2.5mm)$);
     21 			\coordinate (resdst\I) at ($(lin\I.north) + (0, 1mm)$);
     22 			\draw[arrow, rounded corners=2pt] (ressrc\I) -- ($(ressrc\I) + (6mm, 0mm)$) -- ($(resdst\I) + (6mm, 0mm)$) -- (resdst\I);
     23 
     24 			\draw[arrow] (x\I) -- (q\I);
     25 			\draw[arrow] (o\I) -- (lnf\I);
     26 			\draw[arrow] (lnf\I) -- (lin\I);
     27 			\draw[arrow] (lin\I) -- (lns\I);
     28 			\draw[arrow] (lns\I) -- (w\I);
     29 		\end{scope}
     30 	}
     31 
     32 	\draw[memorybrace,decoration={aspect=0.2}] (x1.north west) -- (xm.north east) coordinate[midway,yshift=5] (xbty);
     33 	\path ($(x1.north west)!0.2!(xm.north east)$) |- coordinate (xbt) (xbty);
     34 	\draw[arrow,rounded corners=5pt] (xbt) -- (xbt|-m0) -- (m0);
     35 
     36 	\draw[very thick, dashed] (-1.15, -1.4) -- (3.8, -1.4);
     37 	\draw[very thick, dashed] (-1.15,  3.4) -- (3.8,  3.4);
     38 	\node[rotate=90, fill=white] at (3.7, 1.1) {\marginsize \hphantom{(repeated x times)}};
     39 	\node[rotate=90, fill=white] (name) at (3.35, 1.1) {\large\IfLanguageName{french}{couche \textsc{bert}}{\textsc{bert} layer}};
     40 	\node[rotate=90] at (3.7, 1.1) {\marginsize(\IfLanguageName{french}{répétée 12 fois}{repeated 12 times})};
     41 	\draw[arrow] (name) -- (3.35,  3.4);
     42 	\draw[arrow] (name) -- (3.35, -1.4);
     43 \end{tikzpicture}%