diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-14 01:01:52 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-14 01:04:07 +0100 |
| commit | 1b760f3b413d28652965a51f629d3c2b8d33ce22 (patch) | |
| tree | ca357e0f127b1356301cea23202d2585ea7c1e63 /training/test_viz_precision.py | |
| parent | a29d83f6de08ace2db12347c85be959103d98db5 (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/test_viz_precision.py')
| -rwxr-xr-x | training/test_viz_precision.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/training/test_viz_precision.py b/training/test_viz_precision.py deleted file mode 100755 index 143f4ea..0000000 --- a/training/test_viz_precision.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python3 -"""Test WebGPU → Canvas → PNG precision loss - -Check if bgra8unorm → 2D canvas → PNG loses 2 LSBs. -""" - -import numpy as np - -# Simulate WebGPU bgra8unorm conversion -# Float [0, 1] → uint8 [0, 255] - -test_values = [ - 1.0, # Perfect white - 0.9999, # Near-white - 254.5/255, # Exactly 254.5 - 253.5/255, # Exactly 253.5 -] - -for val in test_values: - # WebGPU bgra8unorm: round(val * 255) - gpu_u8 = int(np.round(val * 255)) - - # Convert back to normalized - gpu_f32 = gpu_u8 / 255.0 - - # JavaScript canvas getImageData: uint8 - canvas_u8 = int(np.round(gpu_f32 * 255)) - - print(f"Input: {val:.6f} → GPU u8: {gpu_u8} → Canvas: {canvas_u8}") - if canvas_u8 != 255: - print(f" ⚠️ Lost {255 - canvas_u8} LSBs") - -print("\nConclusion:") -print("If WebGPU stores 1.0 as 255, canvas should read 255.") -print("If user sees 253, likely:") -print(" a) Not viewing CNN layer (viewing static features at scale=1.0)") -print(" b) Value in texture is already 253/255 = 0.9921875") -print(" c) F16 storage or unpacking issue") |
