Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NAM/dsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ void nam::Conv1x1::process_(const Eigen::Ref<const Eigen::MatrixXf>& 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;
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions NAM/lstm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<const Eigen::VectorXf> get_hidden_state() const
{
return this->_xh.tail(this->_get_hidden_size());
};
Eigen::Ref<const Eigen::VectorXf> get_hidden_state() const { return this->_xh.tail(this->_get_hidden_size()); };

/// \brief Process a single input vector
/// \param x Input vector
Expand Down
10 changes: 5 additions & 5 deletions NAM/wavenet/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion NAM/wavenet/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions NAM/wavenet/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>&& kernel_sizes_,
const std::vector<int>&& 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<int>&& kernel_sizes_, const std::vector<int>&& dilations_,
const std::vector<activations::ActivationConfig>&& activation_configs_,
const std::vector<GatingMode>&& gating_modes_, const bool head_bias_, const int groups_input,
const int groups_input_mixin_, const Layer1x1Params& layer1x1_params_,
Expand Down
6 changes: 4 additions & 2 deletions tools/test/test_a2_fast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
4 changes: 2 additions & 2 deletions tools/test/test_conv1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float>(o + 1) + 0.007f * static_cast<float>(i + 1)
- 0.003f * static_cast<float>(k + 1);
const float value =
0.011f * static_cast<float>(o + 1) + 0.007f * static_cast<float>(i + 1) - 0.003f * static_cast<float>(k + 1);
reference_weights[k](o, i) = value;
weights.push_back(value);
}
Expand Down
3 changes: 1 addition & 2 deletions tools/test/test_lstm_realtime_safe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down
8 changes: 4 additions & 4 deletions tools/test/test_wavenet/test_layer_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ static nam::wavenet::detail::LayerArray make_layer_array(
std::vector<int> dilations_copy = dilations; // Make a copy since we need to move it
std::vector<int> 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
Expand Down
3 changes: 2 additions & 1 deletion tools/test/test_wavenet/test_layer_head_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tools/test/test_wavenet/test_real_time_safe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ static nam::wavenet::detail::LayerArray make_layer_array(
std::vector<int> dilations_copy = dilations; // Make a copy since we need to move it
std::vector<int> 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);
}

Expand Down
8 changes: 4 additions & 4 deletions tools/test/test_wavenet_configurable_gating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ static nam::wavenet::detail::LayerArray make_layer_array(
std::vector<int> dilations_copy = dilations; // Make a copy since we need to move it
std::vector<int> 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);
}

Expand Down
Loading