reworked network arch diagrams

This commit is contained in:
Jan Kowalczyk
2025-09-01 18:53:01 +02:00
parent 5ff56994c0
commit 33de01b150
17 changed files with 156 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
# ====== CONFIG ======
# Add names (without extension). Example: NAMES = report thesis notes
NAMES = subter_lenet_arch subter_ef_arch arch_ef_encoder arch_ef_decoder arch_lenet_encoder arch_lenet_decoder
NAMES = arch_ef_encoder arch_ef_decoder arch_lenet_encoder arch_lenet_decoder
TEX = $(NAMES:%=%.tex)
PDF = $(NAMES:%=%.pdf)
@@ -10,7 +10,7 @@ PDF = $(NAMES:%=%.pdf)
.PRECIOUS: %.tex
# Default: build all PDFs
all: $(PDF)
all: $(PDF) $(TEX)
# ====== Rules ======
# Generate {name}.tex from {name}.py

View File

@@ -38,6 +38,7 @@ arch = [
to_fc(
"fc3",
n_filer="{{8×128×8}}",
zlabeloffset=0.5,
offset="(2,0,0)",
to="(latent-east)",
height=H1,
@@ -47,20 +48,22 @@ arch = [
),
to_Conv(
"unsqueeze",
s_filer="",
s_filer="{{128×8}}",
zlabeloffset=0.4,
n_filer=32,
offset="(2,0,0)",
to="(fc3-east)",
height=H8,
depth=D128,
width=W32,
caption="unsqueeze",
caption="Unsqueeze",
),
# to_connection("latent", "fc3"),
# Reshape to 4×8×512
to_UnPool(
"up1",
offset="(2,0,0)",
n_filer=32,
to="(unsqueeze-east)",
height=H16,
depth=D256,
@@ -76,11 +79,12 @@ arch = [
height=H16,
depth=D256,
width=W1,
caption="deconv1",
caption="Deconv1",
),
to_Conv(
"dwdeconv2",
s_filer="{{256×16}}",
zlabeloffset=0.4,
n_filer=32,
offset="(0,0,0)",
to="(dwdeconv1-east)",
@@ -93,6 +97,7 @@ arch = [
"up2",
offset="(2,0,0)",
to="(dwdeconv2-east)",
n_filer=32,
height=H16,
depth=D1024,
width=W32,
@@ -107,11 +112,12 @@ arch = [
height=H16,
depth=D1024,
width=W1,
caption="deconv2",
caption="Deconv2",
),
to_Conv(
"dwdeconv4",
s_filer="{{1024×16}}",
zlabeloffset=0.17,
n_filer=16,
offset="(0,0,0)",
to="(dwdeconv3-east)",
@@ -123,6 +129,7 @@ arch = [
to_UnPool(
"up3",
offset="(2,0,0)",
n_filer=16,
to="(dwdeconv4-east)",
height=H32,
depth=D2048,
@@ -138,11 +145,12 @@ arch = [
height=H32,
depth=D2048,
width=W1,
caption="deconv3",
caption="Deconv3",
),
to_Conv(
"dwdeconv6",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=8,
offset="(0,0,0)",
to="(dwdeconv5-east)",
@@ -154,26 +162,28 @@ arch = [
to_Conv(
"outconv",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1,
offset="(2,0,0)",
to="(dwdeconv6-east)",
height=H32,
depth=D2048,
width=W1,
caption="deconv4",
caption="Deconv4",
),
# to_connection("up2", "deconv2"),
# Output
to_Conv(
"out",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1,
offset="(2,0,0)",
to="(outconv-east)",
height=H32,
depth=D2048,
width=W1,
caption="output",
caption="Output",
),
# to_connection("deconv2", "out"),
to_end(),

View File

@@ -29,6 +29,7 @@
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,
@@ -43,6 +44,7 @@
name=fc3,
caption=FC,
xlabel={{" ","dummy"}},
zlabeloffset=0.5,
zlabel={{8×128×8}},
fill=\FcColor,
opacity=0.8,
@@ -56,9 +58,10 @@
\pic[shift={(2,0,0)}] at (fc3-east)
{Box={
name=unsqueeze,
caption=unsqueeze,
caption=Unsqueeze,
xlabel={{32, }},
zlabel=,
zlabeloffset=0.4,
zlabel={{128×8}},
fill=\ConvColor,
height=12,
width=8,
@@ -73,6 +76,7 @@
caption=,
fill=\UnpoolColor,
opacity=0.5,
xlabel={{32, }},
height=18,
width=8,
depth=12
@@ -83,8 +87,9 @@
\pic[shift={(0,0,0)}] at (up1-east)
{Box={
name=dwdeconv1,
caption=deconv1,
caption=Deconv1,
xlabel={{1, }},
zlabeloffset=0.3,
zlabel=,
fill=\ConvColor,
height=18,
@@ -99,6 +104,7 @@
name=dwdeconv2,
caption=,
xlabel={{32, }},
zlabeloffset=0.4,
zlabel={{256×16}},
fill=\ConvColor,
height=18,
@@ -114,6 +120,7 @@
caption=,
fill=\UnpoolColor,
opacity=0.5,
xlabel={{32, }},
height=18,
width=8,
depth=36
@@ -124,8 +131,9 @@
\pic[shift={(0,0,0)}] at (up2-east)
{Box={
name=dwdeconv3,
caption=deconv2,
caption=Deconv2,
xlabel={{1, }},
zlabeloffset=0.3,
zlabel=,
fill=\ConvColor,
height=18,
@@ -140,6 +148,7 @@
name=dwdeconv4,
caption=,
xlabel={{16, }},
zlabeloffset=0.17,
zlabel={{1024×16}},
fill=\ConvColor,
height=18,
@@ -155,6 +164,7 @@
caption=,
fill=\UnpoolColor,
opacity=0.5,
xlabel={{16, }},
height=26,
width=4,
depth=52
@@ -165,8 +175,9 @@
\pic[shift={(0,0,0)}] at (up3-east)
{Box={
name=dwdeconv5,
caption=deconv3,
caption=Deconv3,
xlabel={{1, }},
zlabeloffset=0.3,
zlabel=,
fill=\ConvColor,
height=26,
@@ -181,6 +192,7 @@
name=dwdeconv6,
caption=,
xlabel={{8, }},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
@@ -193,8 +205,9 @@
\pic[shift={(2,0,0)}] at (dwdeconv6-east)
{Box={
name=outconv,
caption=deconv4,
caption=Deconv4,
xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
@@ -207,8 +220,9 @@
\pic[shift={(2,0,0)}] at (outconv-east)
{Box={
name=out,
caption=output,
caption=Output,
xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,

View File

@@ -25,6 +25,7 @@ arch = [
# Input 1×32×2048 (caption carries H×W; s_filer is numeric)
to_Conv(
"input",
zlabeloffset=0.2,
s_filer="{{2048×32}}",
n_filer=1,
offset="(0,0,0)",
@@ -32,7 +33,7 @@ arch = [
height=H32,
depth=D2048,
width=W1,
caption="input",
caption="Input",
),
# Conv1 (5x5, same): 1->8, 32×2048
to_Conv(
@@ -48,20 +49,23 @@ arch = [
),
to_Conv(
"dwconv2",
s_filer="",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=16,
offset="(0,0,0)",
to="(dwconv1-east)",
height=H32,
depth=D2048,
width=W16,
caption="conv1",
caption="Conv1",
),
# Pool1 2×2: 32×2048 -> 16×1024
# to_connection("input", "conv1"),
to_Pool(
"pool1",
offset="(0,0,0)",
zlabeloffset=0.3,
s_filer="{{512×32}}",
to="(dwconv2-east)",
height=H32,
depth=D512,
@@ -82,20 +86,23 @@ arch = [
),
to_Conv(
"dwconv4",
s_filer="",
n_filer=32,
zlabeloffset=0.3,
s_filer="{{512×32}}",
offset="(0,0,0)",
to="(dwconv3-east)",
height=H32,
depth=D512,
width=W32,
caption="conv2",
caption="Conv2",
),
# Pool2 2×2: 16×1024 -> 8×512
# to_connection("pool1", "conv2"),
to_Pool(
"pool2",
offset="(0,0,0)",
zlabeloffset=0.45,
s_filer="{{256×16}}",
to="(dwconv4-east)",
height=H16,
depth=D256,
@@ -105,6 +112,8 @@ arch = [
to_Pool(
"pool3",
offset="(0,0,0)",
zlabeloffset=0.45,
s_filer="{{128×8}}",
to="(pool2-east)",
height=H8,
depth=D128,
@@ -113,19 +122,21 @@ arch = [
),
to_Conv(
"squeeze",
s_filer="",
n_filer=8,
zlabeloffset=0.45,
s_filer="{{128×8}}",
offset="(2,0,0)",
to="(pool3-east)",
height=H8,
depth=D128,
width=W8,
caption="squeeze",
caption="Squeeze",
),
# FC -> rep_dim (use numeric n_filer)
to_fc(
"fc1",
n_filer="{{8×128×8}}",
zlabeloffset=0.5,
offset="(2,0,0)",
to="(squeeze-east)",
height=H1,

View File

@@ -27,8 +27,9 @@
\pic[shift={(0,0,0)}] at (0,0,0)
{Box={
name=input,
caption=input,
caption=Input,
xlabel={{1, }},
zlabeloffset=0.2,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
@@ -43,6 +44,7 @@
name=dwconv1,
caption=,
xlabel={{1, }},
zlabeloffset=0.3,
zlabel=,
fill=\ConvColor,
height=26,
@@ -55,9 +57,10 @@
\pic[shift={(0,0,0)}] at (dwconv1-east)
{Box={
name=dwconv2,
caption=conv1,
caption=Conv1,
xlabel={{16, }},
zlabel=,
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=4,
@@ -69,6 +72,9 @@
\pic[shift={ (0,0,0) }] at (dwconv2-east)
{Box={
name=pool1,
xlabel={{, }},
zlabeloffset=0.3,
zlabel={{512×32}},
caption=,
fill=\PoolColor,
opacity=0.5,
@@ -84,6 +90,7 @@
name=dwconv3,
caption=,
xlabel={{1, }},
zlabeloffset=0.3,
zlabel=,
fill=\ConvColor,
height=26,
@@ -96,9 +103,10 @@
\pic[shift={(0,0,0)}] at (dwconv3-east)
{Box={
name=dwconv4,
caption=conv2,
caption=Conv2,
xlabel={{32, }},
zlabel=,
zlabeloffset=0.3,
zlabel={{512×32}},
fill=\ConvColor,
height=26,
width=8,
@@ -110,6 +118,9 @@
\pic[shift={ (0,0,0) }] at (dwconv4-east)
{Box={
name=pool2,
xlabel={{, }},
zlabeloffset=0.45,
zlabel={{256×16}},
caption=,
fill=\PoolColor,
opacity=0.5,
@@ -123,6 +134,9 @@
\pic[shift={ (0,0,0) }] at (pool2-east)
{Box={
name=pool3,
xlabel={{, }},
zlabeloffset=0.45,
zlabel={{128×8}},
caption=,
fill=\PoolColor,
opacity=0.5,
@@ -136,9 +150,10 @@
\pic[shift={(2,0,0)}] at (pool3-east)
{Box={
name=squeeze,
caption=squeeze,
caption=Squeeze,
xlabel={{8, }},
zlabel=,
zlabeloffset=0.45,
zlabel={{128×8}},
fill=\ConvColor,
height=12,
width=2,
@@ -152,6 +167,7 @@
name=fc1,
caption=FC,
xlabel={{" ","dummy"}},
zlabeloffset=0.5,
zlabel={{8×128×8}},
fill=\FcColor,
opacity=0.8,
@@ -167,6 +183,7 @@
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,

View File

@@ -38,6 +38,7 @@ arch = [
to_fc(
"fc3",
n_filer="{{4×512×8}}",
zlabeloffset=0.35,
offset="(2,0,0)",
to="(latent-east)",
height=1.3,
@@ -49,6 +50,7 @@ arch = [
# Reshape to 4×8×512
to_UnPool(
"up1",
n_filer=4,
offset="(2,0,0)",
to="(fc3-east)",
height=H16,
@@ -61,6 +63,7 @@ arch = [
to_Conv(
"deconv1",
s_filer="{{1024×16}}",
zlabeloffset=0.2,
n_filer=8,
offset="(0,0,0)",
to="(up1-east)",
@@ -74,6 +77,7 @@ arch = [
to_UnPool(
"up2",
offset="(2,0,0)",
n_filer=8,
to="(deconv1-east)",
height=H32,
depth=D2048,
@@ -85,6 +89,7 @@ arch = [
to_Conv(
"deconv2",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1,
offset="(0,0,0)",
to="(up2-east)",
@@ -98,6 +103,7 @@ arch = [
to_Conv(
"out",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1,
offset="(2,0,0)",
to="(deconv2-east)",

View File

@@ -29,6 +29,7 @@
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,
@@ -43,6 +44,7 @@
name=fc3,
caption=FC,
xlabel={{" ","dummy"}},
zlabeloffset=0.35,
zlabel={{4×512×8}},
fill=\FcColor,
opacity=0.8,
@@ -59,6 +61,7 @@
caption=,
fill=\UnpoolColor,
opacity=0.5,
xlabel={{4, }},
height=18,
width=2,
depth=36
@@ -71,6 +74,7 @@
name=deconv1,
caption=Deconv1,
xlabel={{8, }},
zlabeloffset=0.2,
zlabel={{1024×16}},
fill=\ConvColor,
height=18,
@@ -86,6 +90,7 @@
caption=,
fill=\UnpoolColor,
opacity=0.5,
xlabel={{8, }},
height=26,
width=4,
depth=52
@@ -98,6 +103,7 @@
name=deconv2,
caption=Deconv2,
xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
@@ -112,6 +118,7 @@
name=out,
caption=Output,
xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,

View File

@@ -26,6 +26,7 @@ arch = [
to_Conv(
"input",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1,
offset="(0,0,0)",
to="(0,0,0)",
@@ -37,7 +38,8 @@ arch = [
# Conv1 (5x5, same): 1->8, 32×2048
to_Conv(
"conv1",
s_filer="{{1024×16}}",
s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=8,
offset="(2,0,0)",
to="(input-east)",
@@ -51,6 +53,8 @@ arch = [
to_Pool(
"pool1",
offset="(0,0,0)",
s_filer="{{1024×16}}",
zlabeloffset=0.3,
to="(conv1-east)",
height=H16,
depth=D1024,
@@ -60,7 +64,8 @@ arch = [
# Conv2 (5x5, same): 8->4, stays 16×1024
to_Conv(
"conv2",
s_filer="{{512×8}}",
s_filer="{{1024×16\hspace{2.5em}512×8}}",
zlabeloffset=0.4,
n_filer=4,
offset="(2,0,0)",
to="(pool1-east)",
@@ -73,7 +78,9 @@ arch = [
# to_connection("pool1", "conv2"),
to_Pool(
"pool2",
s_filer="{{}}",
offset="(0,0,0)",
zlabeloffset=0.3,
to="(conv2-east)",
height=H8,
depth=D512,
@@ -85,6 +92,7 @@ arch = [
"fc1",
n_filer="{{4×512×8}}",
offset="(2,0,0)",
zlabeloffset=0.5,
to="(pool2-east)",
height=1.3,
depth=D512,

View File

@@ -29,6 +29,7 @@
name=input,
caption=Input,
xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
@@ -43,7 +44,8 @@
name=conv1,
caption=Conv1,
xlabel={{8, }},
zlabel={{1024×16}},
zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor,
height=26,
width=4,
@@ -55,6 +57,9 @@
\pic[shift={ (0,0,0) }] at (conv1-east)
{Box={
name=pool1,
xlabel={{, }},
zlabeloffset=0.3,
zlabel={{1024×16}},
caption=,
fill=\PoolColor,
opacity=0.5,
@@ -70,7 +75,8 @@
name=conv2,
caption=Conv2,
xlabel={{4, }},
zlabel={{512×8}},
zlabeloffset=0.4,
zlabel={{1024×16\hspace{2.5em}512×8}},
fill=\ConvColor,
height=18,
width=2,
@@ -82,6 +88,9 @@
\pic[shift={ (0,0,0) }] at (conv2-east)
{Box={
name=pool2,
xlabel={{, }},
zlabeloffset=0.3,
zlabel={{}},
caption=,
fill=\PoolColor,
opacity=0.5,
@@ -97,6 +106,7 @@
name=fc1,
caption=FC,
xlabel={{" ","dummy"}},
zlabeloffset=0.5,
zlabel={{4×512×8}},
fill=\FcColor,
opacity=0.8,
@@ -112,6 +122,7 @@
name=latent,
caption=Latent Space,
xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim,
fill=\ConvColor,
height=19.200000000000003,