From f98903d2befdfd9a0f438a21e6d53028d5c8b080 Mon Sep 17 00:00:00 2001 From: Steven Atkinson Date: Sun, 9 Aug 2026 13:51:56 -0700 Subject: [PATCH] Fix configurable gating test weight vector --- .../test/test_wavenet_configurable_gating.cpp | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tools/test/test_wavenet_configurable_gating.cpp b/tools/test/test_wavenet_configurable_gating.cpp index dc3bbc48..58cee106 100644 --- a/tools/test/test_wavenet_configurable_gating.cpp +++ b/tools/test/test_wavenet_configurable_gating.cpp @@ -299,24 +299,35 @@ class TestConfigurableGating // Set some weights to make the layers produce different outputs std::vector weights; - // Add weights for conv layer (simplified - just enough to make it non-zero) - const int conv_weights = channels * 2 * bottleneck * kernelSize; // 2*bottleneck for gated + // Add weights for conv layer (2*bottleneck outputs for gated), including bias + const int conv_out_channels = 2 * bottleneck; + const int conv_weights = channels * conv_out_channels * kernelSize; + const int conv_bias = conv_out_channels; for (int i = 0; i < conv_weights; i++) { weights.push_back(0.1f * i); } + for (int i = 0; i < conv_bias; i++) + { + weights.push_back(0.01f * i); + } // Add weights for input mixin const int mixin_weights = conditionSize * 2 * bottleneck; for (int i = 0; i < mixin_weights; i++) { weights.push_back(0.05f * i); } - // Add weights for 1x1 conv + // Add weights for 1x1 conv, including bias const int conv1x1_weights = bottleneck * channels; + const int conv1x1_bias = channels; for (int i = 0; i < conv1x1_weights; i++) { weights.push_back(0.02f * i); } + for (int i = 0; i < conv1x1_bias; i++) + { + weights.push_back(0.03f * i); + } // Set weights for all layers auto weights_iter = weights.begin(); @@ -328,6 +339,8 @@ class TestConfigurableGating weights_iter = weights.begin(); layer_relu.set_weights_(weights_iter); + assert(weights_iter == weights.end()); + // Create some test input data Eigen::MatrixXf input(channels, num_frames); input.setRandom(); @@ -375,4 +388,4 @@ void run_configurable_gating_tests() test_wavenet_configurable_gating::TestConfigurableGating::test_layer_array_construction(); test_wavenet_configurable_gating::TestConfigurableGating::test_json_configuration_parsing(); test_wavenet_configurable_gating::TestConfigurableGating::test_activation_function_behavior(); -} \ No newline at end of file +}