From 2a2369e38fbe1bf8261968dafc88dac73bdda7ce Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 10 Feb 2026 20:00:26 +0100 Subject: fix: CNN training normalization pipeline consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Training changes:** - Final layer now outputs [0,1] directly with torch.clamp() - Removed denormalization step (was converting [-1,1] to [0,1]) - Network learns [0,1] output natively **Shader generation fixes:** - Layer 0 uses _src variant (5 params, normalizes [0,1] input internally) - Removed pre-normalization of input texture (handled by _src) - Final layer blending: gray_out already [0,1], no denormalization needed - Added generate_conv_src_function() for all kernel sizes - Auto-generates _src variants when exporting (skips if exists) **Cleanup:** - Removed obsolete 4-channel functions from cnn_conv5x5.wgsl - Keep only 7-channel variants (_7to4, _7to1, _7to4_src) **Normalization flow:** [0,1] texture → _src normalizes to [-1,1] → tanh [-1,1] → ... → final conv [0,1] clipped handoff(Claude): CNN normalization pipeline fixed and consistent with training --- workspaces/main/shaders/cnn/cnn_conv3x3.wgsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'workspaces/main/shaders/cnn/cnn_conv3x3.wgsl') diff --git a/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl b/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl index ebb87b5..96ddf5b 100644 --- a/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl +++ b/workspaces/main/shaders/cnn/cnn_conv3x3.wgsl @@ -144,5 +144,5 @@ fn cnn_conv3x3_7to1( } } - return sum; // Output in [-1,1], needs denormalization + return sum; // Output in [-1,1] } -- cgit v1.2.3