unignored pdfs, added network arch diagrams

This commit is contained in:
Jan Kowalczyk
2025-08-13 15:04:44 +02:00
parent ef311d862e
commit e2040fa547
21 changed files with 1395 additions and 97 deletions

View File

@@ -1,6 +1,6 @@
# ====== CONFIG ======
# Add names (without extension). Example: NAMES = report thesis notes
NAMES = subter_lenet_arch subter_ef_arch
NAMES = subter_lenet_arch subter_ef_arch arch_ef_encoder arch_ef_decoder arch_lenet_encoder arch_lenet_decoder
TEX = $(NAMES:%=%.tex)
PDF = $(NAMES:%=%.pdf)

View File

@@ -0,0 +1,189 @@
# subter_lenet_arch.py
# Requires running from inside the PlotNeuralNet repo, like: python3 ../subter_lenet_arch.py
import sys, argparse
sys.path.append("../") # import pycore from repo root
from pycore.tikzeng import *
parser = argparse.ArgumentParser()
parser.add_argument("--rep_dim", type=int, default=1024, help="latent size for FC")
args = parser.parse_args()
REP = int(args.rep_dim)
# Visual scales so the huge width doesn't dominate the figure
H32, H16, H8, H1 = 26, 18, 12, 1
D2048, D1024, D512, D256, D128, D1 = 52, 36, 24, 12, 6, 1
W1, W4, W8, W16, W32 = 1, 2, 2, 4, 8
arch = [
to_head(".."),
to_cor(),
to_begin(),
to_Conv(
"latent",
n_filer="",
s_filer="latent dim",
offset="(2,0,0)",
to="(0,0,0)",
height=H8 * 1.6,
depth=D1,
width=W1,
caption=f"Latent Space",
),
# to_connection("fc1", "latent"),
# --------------------------- DECODER ---------------------------
# FC back to 16384
to_fc(
"fc3",
n_filer="{{8×128×8}}",
offset="(2,0,0)",
to="(latent-east)",
height=H1,
depth=D512,
width=W1,
caption=f"FC",
),
to_Conv(
"unsqueeze",
s_filer="",
n_filer=32,
offset="(2,0,0)",
to="(fc3-east)",
height=H8,
depth=D128,
width=W32,
caption="unsqueeze",
),
# to_connection("latent", "fc3"),
# Reshape to 4×8×512
to_UnPool(
"up1",
offset="(2,0,0)",
to="(unsqueeze-east)",
height=H16,
depth=D256,
width=W32,
caption="",
),
to_Conv(
"dwdeconv1",
s_filer="",
n_filer=1,
offset="(0,0,0)",
to="(up1-east)",
height=H16,
depth=D256,
width=W1,
caption="deconv1",
),
to_Conv(
"dwdeconv2",
s_filer="{{256×16}}",
n_filer=32,
offset="(0,0,0)",
to="(dwdeconv1-east)",
height=H16,
depth=D256,
width=W32,
caption="",
),
to_UnPool(
"up2",
offset="(2,0,0)",
to="(dwdeconv2-east)",
height=H16,
depth=D1024,
width=W32,
caption="",
),
to_Conv(
"dwdeconv3",
s_filer="",
n_filer=1,
offset="(0,0,0)",
to="(up2-east)",
height=H16,
depth=D1024,
width=W1,
caption="deconv2",
),
to_Conv(
"dwdeconv4",
s_filer="{{1024×16}}",
n_filer=16,
offset="(0,0,0)",
to="(dwdeconv3-east)",
height=H16,
depth=D1024,
width=W16,
caption="",
),
to_UnPool(
"up3",
offset="(2,0,0)",
to="(dwdeconv4-east)",
height=H32,
depth=D2048,
width=W16,
caption="",
),
to_Conv(
"dwdeconv5",
s_filer="",
n_filer=1,
offset="(0,0,0)",
to="(up3-east)",
height=H32,
depth=D2048,
width=W1,
caption="deconv3",
),
to_Conv(
"dwdeconv6",
s_filer="{{2048×32}}",
n_filer=8,
offset="(0,0,0)",
to="(dwdeconv5-east)",
height=H32,
depth=D2048,
width=W8,
caption="",
),
to_Conv(
"outconv",
s_filer="{{2048×32}}",
n_filer=1,
offset="(2,0,0)",
to="(dwdeconv6-east)",
height=H32,
depth=D2048,
width=W1,
caption="deconv4",
),
# to_connection("up2", "deconv2"),
# Output
to_Conv(
"out",
s_filer="{{2048×32}}",
n_filer=1,
offset="(2,0,0)",
to="(outconv-east)",
height=H32,
depth=D2048,
width=W1,
caption="output",
),
# to_connection("deconv2", "out"),
to_end(),
]
def main():
name = "subter_lenet_arch"
to_generate(arch, name + ".tex")
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,223 @@
\documentclass[border=8pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{../layers/}{init}
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
\def\FcColor{rgb:blue,5;red,2.5;white,5}
\def\FcReluColor{rgb:blue,5;red,5;white,4}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
\begin{document}
\begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
\pic[shift={(2,0,0)}] at (0,0,0)
{Box={
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,
width=1,
depth=1
}
};
\pic[shift={(2,0,0)}] at (latent-east)
{Box={
name=fc3,
caption=FC,
xlabel={{" ","dummy"}},
zlabel={{8×128×8}},
fill=\FcColor,
opacity=0.8,
height=1,
width=1,
depth=24
}
};
\pic[shift={(2,0,0)}] at (fc3-east)
{Box={
name=unsqueeze,
caption=unsqueeze,
xlabel={{32, }},
zlabel=,
fill=\ConvColor,
height=12,
width=8,
depth=6
}
};
\pic[shift={ (2,0,0) }] at (unsqueeze-east)
{Box={
name=up1,
caption=,
fill=\UnpoolColor,
opacity=0.5,
height=18,
width=8,
depth=12
}
};
\pic[shift={(0,0,0)}] at (up1-east)
{Box={
name=dwdeconv1,
caption=deconv1,
xlabel={{1, }},
zlabel=,
fill=\ConvColor,
height=18,
width=1,
depth=12
}
};
\pic[shift={(0,0,0)}] at (dwdeconv1-east)
{Box={
name=dwdeconv2,
caption=,
xlabel={{32, }},
zlabel={{256×16}},
fill=\ConvColor,
height=18,
width=8,
depth=12
}
};
\pic[shift={ (2,0,0) }] at (dwdeconv2-east)
{Box={
name=up2,
caption=,
fill=\UnpoolColor,
opacity=0.5,
height=18,
width=8,
depth=36
}
};
\pic[shift={(0,0,0)}] at (up2-east)
{Box={
name=dwdeconv3,
caption=deconv2,
xlabel={{1, }},
zlabel=,
fill=\ConvColor,
height=18,
width=1,
depth=36
}
};
\pic[shift={(0,0,0)}] at (dwdeconv3-east)
{Box={
name=dwdeconv4,
caption=,
xlabel={{16, }},
zlabel={{1024×16}},
fill=\ConvColor,
height=18,
width=4,
depth=36
}
};
\pic[shift={ (2,0,0) }] at (dwdeconv4-east)
{Box={
name=up3,
caption=,
fill=\UnpoolColor,
opacity=0.5,
height=26,
width=4,
depth=52
}
};
\pic[shift={(0,0,0)}] at (up3-east)
{Box={
name=dwdeconv5,
caption=deconv3,
xlabel={{1, }},
zlabel=,
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(0,0,0)}] at (dwdeconv5-east)
{Box={
name=dwdeconv6,
caption=,
xlabel={{8, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=2,
depth=52
}
};
\pic[shift={(2,0,0)}] at (dwdeconv6-east)
{Box={
name=outconv,
caption=deconv4,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(2,0,0)}] at (outconv-east)
{Box={
name=out,
caption=output,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\end{tikzpicture}
\end{document}

View File

@@ -0,0 +1,159 @@
# subter_lenet_arch.py
# Requires running from inside the PlotNeuralNet repo, like: python3 ../subter_lenet_arch.py
import sys, argparse
sys.path.append("../") # import pycore from repo root
from pycore.tikzeng import *
parser = argparse.ArgumentParser()
parser.add_argument("--rep_dim", type=int, default=1024, help="latent size for FC")
args = parser.parse_args()
REP = int(args.rep_dim)
# Visual scales so the huge width doesn't dominate the figure
H32, H16, H8, H1 = 26, 18, 12, 1
D2048, D1024, D512, D256, D128, D1 = 52, 36, 24, 12, 6, 1
W1, W4, W8, W16, W32 = 1, 2, 2, 4, 8
arch = [
to_head(".."),
to_cor(),
to_begin(),
# --------------------------- ENCODER ---------------------------
# Input 1×32×2048 (caption carries H×W; s_filer is numeric)
to_Conv(
"input",
s_filer="{{2048×32}}",
n_filer=1,
offset="(0,0,0)",
to="(0,0,0)",
height=H32,
depth=D2048,
width=W1,
caption="input",
),
# Conv1 (5x5, same): 1->8, 32×2048
to_Conv(
"dwconv1",
s_filer="",
n_filer=1,
offset="(2,0,0)",
to="(input-east)",
height=H32,
depth=D2048,
width=W1,
caption="",
),
to_Conv(
"dwconv2",
s_filer="",
n_filer=16,
offset="(0,0,0)",
to="(dwconv1-east)",
height=H32,
depth=D2048,
width=W16,
caption="conv1",
),
# Pool1 2×2: 32×2048 -> 16×1024
# to_connection("input", "conv1"),
to_Pool(
"pool1",
offset="(0,0,0)",
to="(dwconv2-east)",
height=H32,
depth=D512,
width=W16,
caption="",
),
# Conv2 (5x5, same): 8->4, stays 16×1024
to_Conv(
"dwconv3",
s_filer="",
n_filer=1,
offset="(2,0,0)",
to="(pool1-east)",
height=H32,
depth=D512,
width=W1,
caption="",
),
to_Conv(
"dwconv4",
s_filer="",
n_filer=32,
offset="(0,0,0)",
to="(dwconv3-east)",
height=H32,
depth=D512,
width=W32,
caption="conv2",
),
# Pool2 2×2: 16×1024 -> 8×512
# to_connection("pool1", "conv2"),
to_Pool(
"pool2",
offset="(0,0,0)",
to="(dwconv4-east)",
height=H16,
depth=D256,
width=W32,
caption="",
),
to_Pool(
"pool3",
offset="(0,0,0)",
to="(pool2-east)",
height=H8,
depth=D128,
width=W32,
caption="",
),
to_Conv(
"squeeze",
s_filer="",
n_filer=8,
offset="(2,0,0)",
to="(pool3-east)",
height=H8,
depth=D128,
width=W8,
caption="squeeze",
),
# FC -> rep_dim (use numeric n_filer)
to_fc(
"fc1",
n_filer="{{8×128×8}}",
offset="(2,0,0)",
to="(squeeze-east)",
height=H1,
depth=D512,
width=W1,
caption=f"FC",
),
# to_connection("pool2", "fc1"),
# --------------------------- LATENT ---------------------------
to_Conv(
"latent",
n_filer="",
s_filer="latent dim",
offset="(2,0,0)",
to="(fc1-east)",
height=H8 * 1.6,
depth=D1,
width=W1,
caption=f"Latent Space",
),
to_end(),
]
def main():
name = "subter_lenet_arch"
to_generate(arch, name + ".tex")
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,181 @@
\documentclass[border=8pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{../layers/}{init}
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
\def\FcColor{rgb:blue,5;red,2.5;white,5}
\def\FcReluColor{rgb:blue,5;red,5;white,4}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
\begin{document}
\begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
\pic[shift={(0,0,0)}] at (0,0,0)
{Box={
name=input,
caption=input,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(2,0,0)}] at (input-east)
{Box={
name=dwconv1,
caption=,
xlabel={{1, }},
zlabel=,
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(0,0,0)}] at (dwconv1-east)
{Box={
name=dwconv2,
caption=conv1,
xlabel={{16, }},
zlabel=,
fill=\ConvColor,
height=26,
width=4,
depth=52
}
};
\pic[shift={ (0,0,0) }] at (dwconv2-east)
{Box={
name=pool1,
caption=,
fill=\PoolColor,
opacity=0.5,
height=26,
width=4,
depth=24
}
};
\pic[shift={(2,0,0)}] at (pool1-east)
{Box={
name=dwconv3,
caption=,
xlabel={{1, }},
zlabel=,
fill=\ConvColor,
height=26,
width=1,
depth=24
}
};
\pic[shift={(0,0,0)}] at (dwconv3-east)
{Box={
name=dwconv4,
caption=conv2,
xlabel={{32, }},
zlabel=,
fill=\ConvColor,
height=26,
width=8,
depth=24
}
};
\pic[shift={ (0,0,0) }] at (dwconv4-east)
{Box={
name=pool2,
caption=,
fill=\PoolColor,
opacity=0.5,
height=18,
width=8,
depth=12
}
};
\pic[shift={ (0,0,0) }] at (pool2-east)
{Box={
name=pool3,
caption=,
fill=\PoolColor,
opacity=0.5,
height=12,
width=8,
depth=6
}
};
\pic[shift={(2,0,0)}] at (pool3-east)
{Box={
name=squeeze,
caption=squeeze,
xlabel={{8, }},
zlabel=,
fill=\ConvColor,
height=12,
width=2,
depth=6
}
};
\pic[shift={(2,0,0)}] at (squeeze-east)
{Box={
name=fc1,
caption=FC,
xlabel={{" ","dummy"}},
zlabel={{8×128×8}},
fill=\FcColor,
opacity=0.8,
height=1,
width=1,
depth=24
}
};
\pic[shift={(2,0,0)}] at (fc1-east)
{Box={
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,
width=1,
depth=1
}
};
\end{tikzpicture}
\end{document}

View File

@@ -0,0 +1,120 @@
# subter_lenet_arch.py
# Requires running from inside the PlotNeuralNet repo, like: python3 ../subter_lenet_arch.py
import sys, argparse
sys.path.append("../") # import pycore from repo root
from pycore.tikzeng import *
parser = argparse.ArgumentParser()
parser.add_argument("--rep_dim", type=int, default=1024, help="latent size for FC")
args = parser.parse_args()
REP = int(args.rep_dim)
# Visual scales so the huge width doesn't dominate the figure
H32, H16, H8 = 26, 18, 12
D2048, D1024, D512 = 52, 36, 24
W1, W4, W8 = 1, 2, 4
arch = [
to_head(".."),
to_cor(),
to_begin(),
to_Conv(
"latent",
n_filer="",
s_filer="latent dim",
offset="(2,0,0)",
to="(0,0,0)",
height=H8 * 1.6,
depth=1.3,
width=W1,
caption=f"Latent Space",
),
# to_connection("fc1", "latent"),
# --------------------------- DECODER ---------------------------
# FC back to 16384
to_fc(
"fc3",
n_filer="{{4×512×8}}",
offset="(2,0,0)",
to="(latent-east)",
height=1.3,
depth=D512,
width=W1,
caption=f"FC",
),
# to_connection("latent", "fc3"),
# Reshape to 4×8×512
to_UnPool(
"up1",
offset="(2,0,0)",
to="(fc3-east)",
height=H16,
depth=D1024,
width=W4,
caption="",
),
# Up ×2: 8×512 -> 16×1024 (we just draw a labeled box)
# DeConv1 (5×5, same): 4->8, 16×1024
to_Conv(
"deconv1",
s_filer="{{1024×16}}",
n_filer=8,
offset="(0,0,0)",
to="(up1-east)",
height=H16,
depth=D1024,
width=W8,
caption="deconv1",
),
# to_connection("fc3", "up1"),
# Up ×2: 16×1024 -> 32×2048
to_UnPool(
"up2",
offset="(2,0,0)",
to="(deconv1-east)",
height=H32,
depth=D2048,
width=W8,
caption="",
),
# to_connection("deconv1", "up2"),
# DeConv2 (5×5, same): 8->1, 32×2048
to_Conv(
"deconv2",
s_filer="{{2048×32}}",
n_filer=1,
offset="(0,0,0)",
to="(up2-east)",
height=H32,
depth=D2048,
width=W1,
caption="deconv2",
),
# to_connection("up2", "deconv2"),
# Output
to_Conv(
"out",
s_filer="{{2048×32}}",
n_filer=1,
offset="(2,0,0)",
to="(deconv2-east)",
height=H32,
depth=D2048,
width=1.0,
caption="output",
),
# to_connection("deconv2", "out"),
to_end(),
]
def main():
name = "subter_lenet_arch"
to_generate(arch, name + ".tex")
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,126 @@
\documentclass[border=8pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{../layers/}{init}
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
\def\FcColor{rgb:blue,5;red,2.5;white,5}
\def\FcReluColor{rgb:blue,5;red,5;white,4}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
\begin{document}
\begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
\pic[shift={(2,0,0)}] at (0,0,0)
{Box={
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,
width=1,
depth=1.3
}
};
\pic[shift={(2,0,0)}] at (latent-east)
{Box={
name=fc3,
caption=FC,
xlabel={{" ","dummy"}},
zlabel={{4×512×8}},
fill=\FcColor,
opacity=0.8,
height=1.3,
width=1,
depth=24
}
};
\pic[shift={ (2,0,0) }] at (fc3-east)
{Box={
name=up1,
caption=,
fill=\UnpoolColor,
opacity=0.5,
height=18,
width=2,
depth=36
}
};
\pic[shift={(0,0,0)}] at (up1-east)
{Box={
name=deconv1,
caption=deconv1,
xlabel={{8, }},
zlabel={{1024×16}},
fill=\ConvColor,
height=18,
width=4,
depth=36
}
};
\pic[shift={ (2,0,0) }] at (deconv1-east)
{Box={
name=up2,
caption=,
fill=\UnpoolColor,
opacity=0.5,
height=26,
width=4,
depth=52
}
};
\pic[shift={(0,0,0)}] at (up2-east)
{Box={
name=deconv2,
caption=deconv2,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(2,0,0)}] at (deconv2-east)
{Box={
name=out,
caption=output,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1.0,
depth=52
}
};
\end{tikzpicture}
\end{document}

View File

@@ -0,0 +1,117 @@
# subter_lenet_arch.py
# Requires running from inside the PlotNeuralNet repo, like: python3 ../subter_lenet_arch.py
import sys, argparse
sys.path.append("../") # import pycore from repo root
from pycore.tikzeng import *
parser = argparse.ArgumentParser()
parser.add_argument("--rep_dim", type=int, default=1024, help="latent size for FC")
args = parser.parse_args()
REP = int(args.rep_dim)
# Visual scales so the huge width doesn't dominate the figure
H32, H16, H8 = 26, 18, 12
D2048, D1024, D512 = 52, 36, 24
W1, W4, W8 = 1, 2, 4
arch = [
to_head(".."),
to_cor(),
to_begin(),
# --------------------------- ENCODER ---------------------------
# Input 1×32×2048 (caption carries H×W; s_filer is numeric)
to_Conv(
"input",
s_filer="{{2048×32}}",
n_filer=1,
offset="(0,0,0)",
to="(0,0,0)",
height=H32,
depth=D2048,
width=W1,
caption="input",
),
# Conv1 (5x5, same): 1->8, 32×2048
to_Conv(
"conv1",
s_filer="{{1024×16}}",
n_filer=8,
offset="(2,0,0)",
to="(input-east)",
height=H32,
depth=D2048,
width=W8,
caption="conv1",
),
# Pool1 2×2: 32×2048 -> 16×1024
# to_connection("input", "conv1"),
to_Pool(
"pool1",
offset="(0,0,0)",
to="(conv1-east)",
height=H16,
depth=D1024,
width=W8,
caption="",
),
# Conv2 (5x5, same): 8->4, stays 16×1024
to_Conv(
"conv2",
s_filer="{{512×8}}",
n_filer=4,
offset="(2,0,0)",
to="(pool1-east)",
height=H16,
depth=D1024,
width=W4,
caption="conv2",
),
# Pool2 2×2: 16×1024 -> 8×512
# to_connection("pool1", "conv2"),
to_Pool(
"pool2",
offset="(0,0,0)",
to="(conv2-east)",
height=H8,
depth=D512,
width=W4,
caption="",
),
# FC -> rep_dim (use numeric n_filer)
to_fc(
"fc1",
n_filer="{{4×512×8}}",
offset="(2,0,0)",
to="(pool2-east)",
height=1.3,
depth=D512,
width=W1,
caption=f"FC",
),
# to_connection("pool2", "fc1"),
# --------------------------- LATENT ---------------------------
to_Conv(
"latent",
n_filer="",
s_filer="latent dim",
offset="(2,0,0)",
to="(fc1-east)",
height=H8 * 1.6,
depth=1.3,
width=W1,
caption=f"Latent Space",
),
to_end(),
]
def main():
name = "subter_lenet_arch"
to_generate(arch, name + ".tex")
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,126 @@
\documentclass[border=8pt, multi, tikz]{standalone}
\usepackage{import}
\subimport{../layers/}{init}
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
\def\UnpoolColor{rgb:blue,2;green,1;black,0.3}
\def\FcColor{rgb:blue,5;red,2.5;white,5}
\def\FcReluColor{rgb:blue,5;red,5;white,4}
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
\begin{document}
\begin{tikzpicture}
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
\pic[shift={(0,0,0)}] at (0,0,0)
{Box={
name=input,
caption=input,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(2,0,0)}] at (input-east)
{Box={
name=conv1,
caption=conv1,
xlabel={{8, }},
zlabel={{1024×16}},
fill=\ConvColor,
height=26,
width=4,
depth=52
}
};
\pic[shift={ (0,0,0) }] at (conv1-east)
{Box={
name=pool1,
caption=,
fill=\PoolColor,
opacity=0.5,
height=18,
width=4,
depth=36
}
};
\pic[shift={(2,0,0)}] at (pool1-east)
{Box={
name=conv2,
caption=conv2,
xlabel={{4, }},
zlabel={{512×8}},
fill=\ConvColor,
height=18,
width=2,
depth=36
}
};
\pic[shift={ (0,0,0) }] at (conv2-east)
{Box={
name=pool2,
caption=,
fill=\PoolColor,
opacity=0.5,
height=12,
width=2,
depth=24
}
};
\pic[shift={(2,0,0)}] at (pool2-east)
{Box={
name=fc1,
caption=FC,
xlabel={{" ","dummy"}},
zlabel={{4×512×8}},
fill=\FcColor,
opacity=0.8,
height=1.3,
width=1,
depth=24
}
};
\pic[shift={(2,0,0)}] at (fc1-east)
{Box={
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,
width=1,
depth=1.3
}
};
\end{tikzpicture}
\end{document}

View File

@@ -5,7 +5,6 @@
\usetikzlibrary{positioning}
\usetikzlibrary{3d} %for including external image
\def\ConvColor{rgb:yellow,5;red,2.5;white,5}
\def\ConvReluColor{rgb:yellow,5;red,5;white,5}
\def\PoolColor{rgb:red,1;black,0.3}
@@ -15,7 +14,6 @@
\def\SoftmaxColor{rgb:magenta,5;black,7}
\def\SumColor{rgb:blue,5;green,15}
\newcommand{\copymidarrow}{\tikz \draw[-Stealth,line width=0.8mm,draw={rgb:blue,4;red,1;green,1;black,3}] (-0.3,0) -- ++(0.3,0);}
\begin{document}
@@ -23,91 +21,7 @@
\tikzstyle{connection}=[ultra thick,every node/.style={sloped,allow upside down},draw=\edgecolor,opacity=0.7]
\tikzstyle{copyconnection}=[ultra thick,every node/.style={sloped,allow upside down},draw={rgb:blue,4;red,1;green,1;black,3},opacity=0.7]
\pic[shift={(0,0,0)}] at (0,0,0)
{Box={
name=input,
caption=input,
xlabel={{1, }},
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=1,
depth=52
}
};
\pic[shift={(2,0,0)}] at (input-east)
{Box={
name=conv1,
caption=conv1,
xlabel={{8, }},
zlabel={{1024×16}},
fill=\ConvColor,
height=26,
width=4,
depth=52
}
};
\pic[shift={ (0,0,0) }] at (conv1-east)
{Box={
name=pool1,
caption=,
fill=\PoolColor,
opacity=0.5,
height=18,
width=4,
depth=36
}
};
\pic[shift={(2,0,0)}] at (pool1-east)
{Box={
name=conv2,
caption=conv2,
xlabel={{4, }},
zlabel={{512×8}},
fill=\ConvColor,
height=18,
width=2,
depth=36
}
};
\pic[shift={ (0,0,0) }] at (conv2-east)
{Box={
name=pool2,
caption=,
fill=\PoolColor,
opacity=0.5,
height=12,
width=2,
depth=24
}
};
\pic[shift={(2,0,0)}] at (pool2-east)
{Box={
name=fc1,
caption=FC,
xlabel={{" ","dummy"}},
zlabel={{4×512×8}},
fill=\FcColor,
opacity=0.8,
height=1.3,
width=1,
depth=24
}
};
\pic[shift={(2,0,0)}] at (fc1-east)
\pic[shift={(2,0,0)}] at (0,0,0)
{Box={
name=latent,
caption=Latent Space,
@@ -120,7 +34,6 @@
}
};
\pic[shift={(2,0,0)}] at (latent-east)
{Box={
name=fc3,
@@ -135,7 +48,6 @@
}
};
\pic[shift={ (2,0,0) }] at (fc3-east)
{Box={
name=up1,
@@ -148,7 +60,6 @@
}
};
\pic[shift={(0,0,0)}] at (up1-east)
{Box={
name=deconv1,
@@ -162,7 +73,6 @@
}
};
\pic[shift={ (2,0,0) }] at (deconv1-east)
{Box={
name=up2,
@@ -175,7 +85,6 @@
}
};
\pic[shift={(0,0,0)}] at (up2-east)
{Box={
name=deconv2,
@@ -189,7 +98,6 @@
}
};
\pic[shift={(2,0,0)}] at (deconv2-east)
{Box={
name=out,
@@ -203,7 +111,5 @@
}
};
\end{tikzpicture}
\end{document}