Skip to content

Commit

Permalink
Added dark mode for the optimization scheme.
Browse files Browse the repository at this point in the history
  • Loading branch information
benedict-96 committed Dec 21, 2023
1 parent 11b00ca commit d42e956
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 14 deletions.
6 changes: 5 additions & 1 deletion docs/src/Optimizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ Starting from an element of the tangent space $T_Y\mathcal{M}$[^1], we need to p

[^1]: In practice this is obtained by first using an AD routine on a loss function $L$, and then computing the Riemannian gradient based on this. See the section of the [Stiefel manifold](manifolds/stiefel_manifold.md) for an example of this.

![](tikz/general_optimization_with_boundary.png)

```@raw html
<img class="display-light-only" src="tikz/general_optimization_with_boundary.png">
<img class="display-dark-only" src="tikz/general_optimization_with_boundary_dark.png">
```

Here the mapping $\Omega$ is a [horizontal lift](optimizers/manifold_related/horizontal_lift.md) from the tangent space onto the **horizontal component of the Lie algebra at $Y$**.

Expand Down
28 changes: 15 additions & 13 deletions docs/src/tikz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pdf:
xelatex -shell-escape adam_optimizer
xelatex -shell-escape general_optimization
xelatex -shell-escape general_optimization_with_boundary
xelatex -shell-escape general_optimization_with_boundary_dark
xelatex -shell-escape transformer_encoder
xelatex -shell-escape third_degree_spline
xelatex -shell-escape sympnet_architecture
Expand All @@ -14,19 +15,20 @@ pdf:
xelatex -shell-escape mha

png:
pdftocairo -png -r 150 -transp -singlefile adam_optimizer.pdf adam_optimizer
pdftocairo -png -r 150 -transp -singlefile general_optimization.pdf general_optimization
pdftocairo -png -r 150 -transp -singlefile general_optimization_with_boundary.pdf general_optimization_with_boundary
pdftocairo -png -r 150 -transp -singlefile transformer_encoder.pdf transformer_encoder
pdftocairo -png -r 150 -transp -singlefile third_degree_spline.pdf third_degree_spline
pdftocairo -png -r 150 -transp -singlefile sympnet_architecture.pdf sympnet_architecture
pdftocairo -png -r 150 -transp -singlefile sympnet_architecture_dark.pdf sympnet_architecture_dark
pdftocairo -png -r 150 -transp -singlefile structs_visualization.pdf structs_visualization
pdftocairo -png -r 150 -transp -singlefile structs_visualization_dark.pdf structs_visualization_dark
pdftocairo -png -r 150 -transp -singlefile logo.pdf logo
pdftocairo -png -r 150 -transp -singlefile symplectic_autoencoder.pdf symplectic_autoencoder
pdftocairo -png -r 150 -transp -singlefile solution_manifold_2.pdf solution_manifold_2
pdftocairo -png -r 150 -transp -singlefile mha.pdf mha
pdftocairo -png -r 150 -transp -singlefile adam_optimizer.pdf adam_optimizer
pdftocairo -png -r 150 -transp -singlefile general_optimization.pdf general_optimization
pdftocairo -png -r 150 -transp -singlefile general_optimization_with_boundary.pdf general_optimization_with_boundary
pdftocairo -png -r 150 -transp -singlefile general_optimization_with_boundary_dark.pdf general_optimization_with_boundary_dark
pdftocairo -png -r 150 -transp -singlefile transformer_encoder.pdf transformer_encoder
pdftocairo -png -r 150 -transp -singlefile third_degree_spline.pdf third_degree_spline
pdftocairo -png -r 150 -transp -singlefile sympnet_architecture.pdf sympnet_architecture
pdftocairo -png -r 150 -transp -singlefile sympnet_architecture_dark.pdf sympnet_architecture_dark
pdftocairo -png -r 150 -transp -singlefile structs_visualization.pdf structs_visualization
pdftocairo -png -r 150 -transp -singlefile structs_visualization_dark.pdf structs_visualization_dark
pdftocairo -png -r 150 -transp -singlefile logo.pdf logo
pdftocairo -png -r 150 -transp -singlefile symplectic_autoencoder.pdf symplectic_autoencoder
pdftocairo -png -r 150 -transp -singlefile solution_manifold_2.pdf solution_manifold_2
pdftocairo -png -r 150 -transp -singlefile mha.pdf mha

logo:
xelatex -shell-escape logo_with_name
Expand Down
41 changes: 41 additions & 0 deletions docs/src/tikz/general_optimization_with_boundary_dark.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
\documentclass[crop, tikz]{standalone}

\usepackage{tikz}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[mode=buildnew]{standalone}

\usepackage{xcolor}


\usetikzlibrary{fit}

\definecolor{mred}{RGB}{214,39,40}
\definecolor{mgreen}{RGB}{44,160,44}


\begin{document}
\begin{tikzpicture}
\node[rectangle, draw] (TYM) at (0, 0) {\color{white}$T_Y\mathcal{M}$};
\node[rectangle, draw] (ghorY) at (0, 2) {\color{white}$\mathfrak{g}^{\mathrm{hor},Y}$};
\node[rectangle, draw] (ghor) at (2, 2) {\color{white}$\mathfrak{g}^{\mathrm{hor}}$};
\node[rectangle, draw] (cache) at (2, 0) {\color{white}$\mathtt{cache}$};
\node[rectangle, draw] (ghor2) at (4, 1) {\color{white}$\mathfrak{g}^\mathrm{hor}$};
\node[rectangle, draw] (M) at (4, 0) {\color{white}$\mathcal{M}$};
\node[rectangle, draw] (Euc) at (-2.2,0) {\color{white}$\mathbb{R}^{N\times{}n}$};
\node[rectangle, draw] (M2) at (-3.5,-1) {\color{white}$\mathcal{M}$};
\node[rectangle, draw] (M3) at (4, -1) {\color{white}$\mathcal{M}$};
\coordinate[right of=M, xshift=1.5cm] (apply_section);
\node[fit=(Euc)(ghorY)(ghor)(ghor2)(M3)(apply_section),draw, ultra thick, rounded corners, label=below:{\color{white}$\mathtt{optimization\_step(o::Optimizer,model, ::}\mathcal{M}\mathtt{,::}\mathbb{R}^{N\times{}n}\mathtt{)}$},color=white] (optimization_step) {};

\coordinate[below of=Euc, yshift=.7cm, xshift=-.3cm] (below_Euc);
\draw[->, white] (TYM) -- (ghorY) node[pos=.5, left] {$\Omega$};
\draw[->, mred] (ghorY) -- (ghor);
\draw[->, white] (ghor) -- (cache) node[pos=.5, sloped, below] {Adam};
\draw[->, white] (cache) -- (ghor2) node[pos=.5, sloped, above] {Adam};
\draw[->, white] (ghor2) -- (M) node[pos=.5, right] {Retraction};
\draw[->, mgreen] (M2) -- (below_Euc) node[pos=.5, left] {\color{mgreen}AD};
\draw[->, white] (Euc) -- (TYM) node[pos=.5, above] {$\mathtt{rgrad}$};
\draw[->, mred] (M) -- (M3) node[pos=.5, right] {$\mathtt{apply\_section}$};
\end{tikzpicture}
\end{document}

0 comments on commit d42e956

Please sign in to comment.