diff --git a/NAM/dsp.cpp b/NAM/dsp.cpp index c83bf0c8..dc6449e9 100644 --- a/NAM/dsp.cpp +++ b/NAM/dsp.cpp @@ -699,8 +699,8 @@ void nam::Conv1x1::process_(const Eigen::Ref& input, cons const float i3 = in_col[3], i4 = in_col[4], i5 = in_col[5]; for (int o = 0; o < 8; o++) { - out_col[o] = weight_ptr[o] * i0 + weight_ptr[8 + o] * i1 + weight_ptr[16 + o] * i2 - + weight_ptr[24 + o] * i3 + weight_ptr[32 + o] * i4 + weight_ptr[40 + o] * i5; + out_col[o] = weight_ptr[o] * i0 + weight_ptr[8 + o] * i1 + weight_ptr[16 + o] * i2 + weight_ptr[24 + o] * i3 + + weight_ptr[32 + o] * i4 + weight_ptr[40 + o] * i5; } } } diff --git a/NAM/lstm.h b/NAM/lstm.h index 92f341dc..92a80b91 100644 --- a/NAM/lstm.h +++ b/NAM/lstm.h @@ -29,10 +29,7 @@ class LSTMCell /// Returns an Eigen::Ref rather than a by-value Eigen::VectorXf so that reading the hidden state /// does not heap-allocate. This is required for real-time safety: process_() is called once per /// audio sample, and a by-value return would allocate on every layer hop and head evaluation. - Eigen::Ref get_hidden_state() const - { - return this->_xh.tail(this->_get_hidden_size()); - }; + Eigen::Ref get_hidden_state() const { return this->_xh.tail(this->_get_hidden_size()); }; /// \brief Process a single input vector /// \param x Input vector diff --git a/NAM/wavenet/model.cpp b/NAM/wavenet/model.cpp index 639195b9..7689625d 100644 --- a/NAM/wavenet/model.cpp +++ b/NAM/wavenet/model.cpp @@ -1153,11 +1153,11 @@ nam::wavenet::WaveNetConfig nam::wavenet::parse_config_json(const nlohmann::json } wc.layer_array_params.push_back(nam::wavenet::LayerArrayParams( - input_size, condition_size, head_size, head_dilation, head_kernel_size, channels, bottleneck, std::move(kernel_sizes), dilations, - std::move(activation_configs), std::move(gating_modes), head_bias, groups, groups_input_mixin, layer1x1_params, - head1x1_params, std::move(secondary_activation_configs), conv_pre_film_params, conv_post_film_params, - input_mixin_pre_film_params, input_mixin_post_film_params, activation_pre_film_params, - activation_post_film_params, _layer1x1_post_film_params, head1x1_post_film_params)); + input_size, condition_size, head_size, head_dilation, head_kernel_size, channels, bottleneck, + std::move(kernel_sizes), dilations, std::move(activation_configs), std::move(gating_modes), head_bias, groups, + groups_input_mixin, layer1x1_params, head1x1_params, std::move(secondary_activation_configs), + conv_pre_film_params, conv_post_film_params, input_mixin_pre_film_params, input_mixin_post_film_params, + activation_pre_film_params, activation_post_film_params, _layer1x1_post_film_params, head1x1_post_film_params)); } wc.with_head = config.find("head") != config.end() && !config["head"].is_null(); diff --git a/NAM/wavenet/model.h b/NAM/wavenet/model.h index c914227f..5941892e 100644 --- a/NAM/wavenet/model.h +++ b/NAM/wavenet/model.h @@ -115,7 +115,6 @@ class WaveNet : public DSP Eigen::MatrixXf _scaled_head_scratch; int mPrewarmSamples = 0; // Pre-compute during initialization - }; /// \brief Configuration for a WaveNet model diff --git a/NAM/wavenet/params.h b/NAM/wavenet/params.h index 5da9b752..1f45d2f7 100644 --- a/NAM/wavenet/params.h +++ b/NAM/wavenet/params.h @@ -205,9 +205,9 @@ class LayerArrayParams /// \param head1x1_post_film_params_ FiLM parameters after head1x1 convolutions /// \throws std::invalid_argument If dilations, activation_configs, gating_modes, or secondary_activation_configs /// sizes don't match - LayerArrayParams(const int input_size_, const int condition_size_, const int head_size_, const int head_dilation_, const int head_kernel_size_, - const int channels_, const int bottleneck_, const std::vector&& kernel_sizes_, - const std::vector&& dilations_, + LayerArrayParams(const int input_size_, const int condition_size_, const int head_size_, const int head_dilation_, + const int head_kernel_size_, const int channels_, const int bottleneck_, + const std::vector&& kernel_sizes_, const std::vector&& dilations_, const std::vector&& activation_configs_, const std::vector&& gating_modes_, const bool head_bias_, const int groups_input, const int groups_input_mixin_, const Layer1x1Params& layer1x1_params_, diff --git a/tools/test/test_a2_fast.cpp b/tools/test/test_a2_fast.cpp index 60df7302..742d04d7 100644 --- a/tools/test/test_a2_fast.cpp +++ b/tools/test/test_a2_fast.cpp @@ -235,8 +235,10 @@ void test_detector_rejects_gating() void test_detector_rejects_condition_dsp() { auto cfg = build_a2_config(8); - cfg["condition_dsp"] = {{"version", "0.5.0"}, {"architecture", "Linear"}, - {"config", nlohmann::json::object()}, {"weights", nlohmann::json::array()}}; + cfg["condition_dsp"] = {{"version", "0.5.0"}, + {"architecture", "Linear"}, + {"config", nlohmann::json::object()}, + {"weights", nlohmann::json::array()}}; assert(!nam::wavenet::a2_fast::is_a2_shape(cfg, nullptr)); } diff --git a/tools/test/test_conv1d.cpp b/tools/test/test_conv1d.cpp index cc217403..b1c1cf5c 100644 --- a/tools/test/test_conv1d.cpp +++ b/tools/test/test_conv1d.cpp @@ -35,8 +35,8 @@ void test_process_matches_reference(const int in_channels, const int out_channel { for (int k = 0; k < kernel_size; k++) { - const float value = 0.011f * static_cast(o + 1) + 0.007f * static_cast(i + 1) - - 0.003f * static_cast(k + 1); + const float value = + 0.011f * static_cast(o + 1) + 0.007f * static_cast(i + 1) - 0.003f * static_cast(k + 1); reference_weights[k](o, i) = value; weights.push_back(value); } diff --git a/tools/test/test_lstm_realtime_safe.cpp b/tools/test/test_lstm_realtime_safe.cpp index 6b69f7f9..cfa23342 100644 --- a/tools/test/test_lstm_realtime_safe.cpp +++ b/tools/test/test_lstm_realtime_safe.cpp @@ -136,8 +136,7 @@ void test_lstm_process_consecutive_calls_realtime_safe() for (int call = 0; call < 8; call++) lstm.process(input_ptrs, output_ptrs, num_frames); }, - nullptr, - "LSTM process (8 consecutive calls)"); + nullptr, "LSTM process (8 consecutive calls)"); for (int i = 0; i < num_frames; i++) assert(std::isfinite(output[i])); diff --git a/tools/test/test_wavenet/test_layer_array.cpp b/tools/test/test_wavenet/test_layer_array.cpp index 984b10d7..7b5e0916 100644 --- a/tools/test/test_wavenet/test_layer_array.cpp +++ b/tools/test/test_wavenet/test_layer_array.cpp @@ -36,10 +36,10 @@ static nam::wavenet::detail::LayerArray make_layer_array( std::vector dilations_copy = dilations; // Make a copy since we need to move it std::vector kernel_sizes(dilations.size(), kernel_size); nam::wavenet::LayerArrayParams params( - input_size, condition_size, head_size, 1, 1, channels, bottleneck, std::move(kernel_sizes), std::move(dilations_copy), - std::move(activation_configs), std::move(gating_modes), head_bias, groups_input, groups_input_mixin, - layer1x1_params, head1x1_params, std::move(secondary_activation_configs), film_params, film_params, film_params, - film_params, film_params, film_params, film_params, film_params); + input_size, condition_size, head_size, 1, 1, channels, bottleneck, std::move(kernel_sizes), + std::move(dilations_copy), std::move(activation_configs), std::move(gating_modes), head_bias, groups_input, + groups_input_mixin, layer1x1_params, head1x1_params, std::move(secondary_activation_configs), film_params, + film_params, film_params, film_params, film_params, film_params, film_params, film_params); return nam::wavenet::detail::LayerArray(params); } // Test layer array construction and basic processing diff --git a/tools/test/test_wavenet/test_layer_head_config.cpp b/tools/test/test_wavenet/test_layer_head_config.cpp index dec79886..cc58e3d1 100644 --- a/tools/test/test_wavenet/test_layer_head_config.cpp +++ b/tools/test/test_wavenet/test_layer_head_config.cpp @@ -90,7 +90,8 @@ void test_nested_head_with_dilation_three() assert(p.head_bias == true); nam::wavenet::detail::LayerArray array(p); - assert(array.get_receptive_field() == 6); // one dilated layer: 0 + (3-1) head rechannel -- tripled because of head_dilation + assert(array.get_receptive_field() + == 6); // one dilated layer: 0 + (3-1) head rechannel -- tripled because of head_dilation } } // namespace test_layer_head_config diff --git a/tools/test/test_wavenet/test_real_time_safe.cpp b/tools/test/test_wavenet/test_real_time_safe.cpp index e707c7b0..043e604b 100644 --- a/tools/test/test_wavenet/test_real_time_safe.cpp +++ b/tools/test/test_wavenet/test_real_time_safe.cpp @@ -59,10 +59,10 @@ static nam::wavenet::detail::LayerArray make_layer_array( std::vector dilations_copy = dilations; // Make a copy since we need to move it std::vector kernel_sizes(dilations.size(), kernel_size); nam::wavenet::LayerArrayParams params( - input_size, condition_size, head_size, 1, 1, channels, bottleneck, std::move(kernel_sizes), std::move(dilations_copy), - std::move(activation_configs), std::move(gating_modes), head_bias, groups_input, groups_input_mixin, - layer1x1_params, head1x1_params, std::move(secondary_activation_configs), film_params, film_params, film_params, - film_params, film_params, film_params, film_params, film_params); + input_size, condition_size, head_size, 1, 1, channels, bottleneck, std::move(kernel_sizes), + std::move(dilations_copy), std::move(activation_configs), std::move(gating_modes), head_bias, groups_input, + groups_input_mixin, layer1x1_params, head1x1_params, std::move(secondary_activation_configs), film_params, + film_params, film_params, film_params, film_params, film_params, film_params, film_params); return nam::wavenet::detail::LayerArray(params); } diff --git a/tools/test/test_wavenet_configurable_gating.cpp b/tools/test/test_wavenet_configurable_gating.cpp index 58cee106..41bb0c12 100644 --- a/tools/test/test_wavenet_configurable_gating.cpp +++ b/tools/test/test_wavenet_configurable_gating.cpp @@ -73,10 +73,10 @@ static nam::wavenet::detail::LayerArray make_layer_array( std::vector dilations_copy = dilations; // Make a copy since we need to move it std::vector kernel_sizes(dilations.size(), kernel_size); nam::wavenet::LayerArrayParams params( - input_size, condition_size, head_size, 1, 1, channels, bottleneck, std::move(kernel_sizes), std::move(dilations_copy), - std::move(activation_configs), std::move(gating_modes), head_bias, groups_input, groups_input_mixin, - layer1x1_params, head1x1_params, std::move(secondary_activation_configs), film_params, film_params, film_params, - film_params, film_params, film_params, film_params, film_params); + input_size, condition_size, head_size, 1, 1, channels, bottleneck, std::move(kernel_sizes), + std::move(dilations_copy), std::move(activation_configs), std::move(gating_modes), head_bias, groups_input, + groups_input_mixin, layer1x1_params, head1x1_params, std::move(secondary_activation_configs), film_params, + film_params, film_params, film_params, film_params, film_params, film_params, film_params); return nam::wavenet::detail::LayerArray(params); }