figure-weight-similarity.tex 3.32 KB
Newer Older
孟霞 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
% set table width
\newcommand{\PreserveBackslash}[1]{\let\temp=\\#1\let\\=\temp}
\newcolumntype{C}[1]{>{\PreserveBackslash\centering}p{#1}}
% used for heatmap
\newcommand*{\MinNumber}{0}%
\newcommand*{\MaxNumber}{1}%
\newcommand{\ApplyGradient}[1]{%
	\pgfmathsetmacro{\PercentColor}{100.0*(#1-\MinNumber)/(\MaxNumber-\MinNumber)}
	\hspace{-0.33em}\colorbox{white!\PercentColor!myblack}{}
}
\newcolumntype{Q}{>{\collectcell\ApplyGradient}c<{\endcollectcell}}

	\begin{center}
		\renewcommand{\arraystretch}{0}
		\setlength{\tabcolsep}{5mm}
		\setlength{\fboxsep}{2.2mm} % box size
		\begin{tabular}{C{.20\textwidth}C{.20\textwidth}C{.20\textwidth}C{.20\textwidth}}
			\setlength{\tabcolsep}{0pt}
			\subfigure [\footnotesize{自注意力}] {
孟霞 committed
20
				\begin{tabular}{ccC{1em}}
孟霞 committed
21 22 23 24
					\setlength{\tabcolsep}{0pt}
					~
					&
					\begin{tikzpicture}
孟霞 committed
25
					\begin{scope}			
孟霞 committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
					\node [inner sep=1.5pt] (w1) at (0,0) {\small{$1$} };
					
					\foreach \x/\y/\z in {2/1/$2$, 3/2/$3$, 4/3/$4$, 5/4/$5$, 6/5/$6$}
					{
						\node [inner sep=1.5pt,anchor=south west] (w\x) at ([xshift=1.15em]w\y.south west) {\small{\z} };
					}
					\end{scope}
					\end{tikzpicture}
					\\
					\renewcommand\arraystretch{1}
					\begin{tabular}{c}
						\setlength{\tabcolsep}{0pt}
						\small{$1\ \ $} \\
						\small{$2\ $} \\
						\small{$3\ $} \\
						\small{$4\ $} \\
						\small{$5\ $} \\
						\small{$6\ $} \\
					\end{tabular}
					&
					%\setlength{\tabcolsep}{0pt}
					\begin{tabular}{*{6}{Q}}
						0.0000 & 0.5429 & 0.5138 & 0.4650 & 0.5005 & 0.5531 \\

                        0.5429 & 0.0000 & 0.0606 & 0.0630 & 0.0703 & 0.0332 \\

                        0.5138 & 0.0606 & 0.0000 & 0.0671 & 0.0472 & 0.0296 \\

                        0.4650 & 0.0630 & 0.0671 & 0.0000 & 0.0176 & 0.0552 \\

                        0.5005 & 0.0703 & 0.0472 & 0.0176 & 0.0000 & 0.0389 \\

                        0.5531 & 0.0332 & 0.0296 & 0.0552 & 0.0389 & 0.0000 \\
					\end{tabular}
孟霞 committed
60
&
孟霞 committed
61 62 63 64 65 66
				\end{tabular}
			}
			&
			
			\subfigure [\footnotesize{编码-解码注意力}] {
				\setlength{\tabcolsep}{0pt}
孟霞 committed
67
				\begin{tabular}{ccC{1em}}
孟霞 committed
68 69 70 71
					\setlength{\tabcolsep}{0pt}
					~
					&
					\begin{tikzpicture}
孟霞 committed
72 73
					\begin{scope}
						
孟霞 committed
74 75 76 77 78 79
					\node [inner sep=1.5pt] (w1) at (0,0) {\small{$1$} };
					\foreach \x/\y/\z in {2/1/$2$, 3/2/$3$, 4/3/$4$, 5/4/$5$, 6/5/$6$}
					{
						\node [inner sep=1.5pt,anchor=south west] (w\x) at ([xshift=1.15em]w\y.south west) {\small{\z} };
					}
					\end{scope}
孟霞 committed
80

孟霞 committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
					\end{tikzpicture}
					\\
					\renewcommand\arraystretch{1}
					\begin{tabular}{c}
						\setlength{\tabcolsep}{0pt}
						\small{$1\ \ $} \\
						\small{$2\ $} \\
						\small{$3\ $} \\
						\small{$4\ $} \\
						\small{$5\ $} \\
						\small{$6\ $} \\
					\end{tabular}
					&
					%\setlength{\tabcolsep}{0pt}
					\begin{tabular}{*{6}{Q}}
                        0.0000 & 0.0175 & 0.2239 & 0.3933 & 0.7986 & 0.3603 \\

                        0.0175 & 0.0000 & 0.1442 & 0.3029 & 0.7295 & 0.3324 \\

                        0.2239 & 0.1442 & 0.0000 & 0.0971 & 0.6270 & 0.4163 \\

                        0.3933 & 0.3029 & 0.0971 & 0.0000 & 0.2385 & 0.2022 \\

                        0.7986 & 0.7295 & 0.6270 & 0.2385 & 0.0000 & 0.0658 \\

                        0.3603 & 0.3324 & 0.4163 & 0.2022 & 0.0658 & 0.0000 \\
					\end{tabular}
孟霞 committed
108
&
孟霞 committed
109 110 111 112
				\end{tabular}
			}
		\end{tabular}
	\end{center}