summaryrefslogtreecommitdiff
path: root/training/gen_identity_weights.py
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-14 01:01:52 +0100
committerskal <pascal.massimino@gmail.com>2026-02-14 01:04:07 +0100
commit1b760f3b413d28652965a51f629d3c2b8d33ce22 (patch)
treeca357e0f127b1356301cea23202d2585ea7c1e63 /training/gen_identity_weights.py
parenta29d83f6de08ace2db12347c85be959103d98db5 (diff)
Fix --mix option: blend prev layer with static p4-p7, not p0-p3
Updated gen_identity_weights.py --mix mode to use static features p4-p7 (uv_x, uv_y, sin20_y, bias) at channels 8-11 instead of p0-p3 (RGB+D) at channels 4-7. Before: 0.5*prev[i] + 0.5*static_p{i} (channels 4-7) After: 0.5*prev[i] + 0.5*static_p{4+i} (channels 8-11) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'training/gen_identity_weights.py')
-rwxr-xr-xtraining/gen_identity_weights.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/training/gen_identity_weights.py b/training/gen_identity_weights.py
index 5d83bfb..7865d68 100755
--- a/training/gen_identity_weights.py
+++ b/training/gen_identity_weights.py
@@ -4,8 +4,8 @@
Creates trivial .bin with 1 layer, 1×1 kernel, identity passthrough.
Output Ch{0,1,2,3} = Input Ch{0,1,2,3} (ignores static features).
-With --mix: Output Ch{i} = 0.5*Input Ch{i} + 0.5*Input Ch{i+4}
- (50-50 blend, avoids overflow)
+With --mix: Output Ch{i} = 0.5*prev[i] + 0.5*static_p{4+i}
+ (50-50 blend of prev layer with uv_x, uv_y, sin20_y, bias)
With --p47: Output Ch{i} = static p{4+i} (uv_x, uv_y, sin20_y, bias)
(p4/uv_x→ch0, p5/uv_y→ch1, p6/sin20_y→ch2, p7/bias→ch3)
@@ -69,10 +69,11 @@ def generate_identity_weights(output_path, kernel_size=1, mip_level=0, mix=False
for i in range(out_channels):
weights[i, i + 8, center, center] = 1.0
elif mix:
- # Mix mode: 50-50 blend to avoid overflow
+ # Mix mode: 50-50 blend (p0+p4, p1+p5, p2+p6, p3+p7)
+ # p0-p3 are at channels 0-3 (prev layer), p4-p7 at channels 8-11 (static)
for i in range(out_channels):
- weights[i, i, center, center] = 0.5 # 0.5*p{i}
- weights[i, i + 4, center, center] = 0.5 # 0.5*p{i+4}
+ weights[i, i, center, center] = 0.5 # 0.5*p{i} (prev layer)
+ weights[i, i + 8, center, center] = 0.5 # 0.5*p{i+4} (static)
else:
# Identity: output ch i = input ch i
for i in range(out_channels):
@@ -89,7 +90,7 @@ def generate_identity_weights(output_path, kernel_size=1, mip_level=0, mix=False
print(f" Weights: {weight_count}")
print(f" Mip level: {mip_level}")
if mix:
- print(f" Mode: 0.5*p0+0.5*p4, 0.5*p1+0.5*p5, 0.5*p2+0.5*p6, 0.5*p3+0.5*p7")
+ print(f" Mode: 0.5*prev[i] + 0.5*static_p{{4+i}} (blend with uv/sin/bias)")
elif p47:
print(f" Mode: p4→ch0, p5→ch1, p6→ch2, p7→ch3")