mirror of
https://github.com/wassname/draw_diag.git
synced 2026-06-27 18:04:49 +08:00
40 lines
1.3 KiB
TeX
40 lines
1.3 KiB
TeX
\documentclass[tikz,border=10pt]{standalone}
|
|
\usepackage{tikz}
|
|
\usetikzlibrary{arrows.meta,positioning,shapes.geometric,calc}
|
|
|
|
\begin{document}
|
|
\begin{tikzpicture}[
|
|
node distance=2cm,
|
|
box/.style={rectangle, draw, minimum width=2.5cm, minimum height=1cm, align=center},
|
|
arrow/.style={-Stealth, thick}
|
|
]
|
|
|
|
% Example: Inner Contrastive Loss Flow
|
|
\node[box, fill=blue!20] (input) {Hidden States\\$h_s$};
|
|
\node[box, fill=green!20, below left=of input] (pos) {Positive\\$h_{pos}$};
|
|
\node[box, fill=red!20, below right=of input] (neg) {Negative\\$h_{neg}$};
|
|
|
|
\node[box, fill=yellow!20, below=3cm of input] (proj) {Projection\\$\mathbf{V}$};
|
|
|
|
\node[box, fill=purple!20, below left=1.5cm and 1cm of proj] (in) {In-Space\\Energy};
|
|
\node[box, fill=orange!20, below right=1.5cm and 1cm of proj] (null) {Null-Space\\Energy};
|
|
|
|
\node[box, fill=gray!20, below=2cm of proj] (loss) {Combined Loss\\$\mathcal{L}$};
|
|
|
|
% Arrows
|
|
\draw[arrow] (input) -- (pos);
|
|
\draw[arrow] (input) -- (neg);
|
|
\draw[arrow] (pos) -- (proj);
|
|
\draw[arrow] (neg) -- (proj);
|
|
\draw[arrow] (proj) -- (in);
|
|
\draw[arrow] (proj) -- (null);
|
|
\draw[arrow] (in) -- (loss);
|
|
\draw[arrow] (null) -- (loss);
|
|
|
|
% Labels
|
|
\node[above right=0.1cm of input, font=\small] {Split};
|
|
\node[left=0.1cm of proj, font=\small, text width=2cm] {Project to\\subspace};
|
|
|
|
\end{tikzpicture}
|
|
\end{document}
|