From 86a9ca43f8af6a7d0b9dbc4fd6c3bc5fff50b01d Mon Sep 17 00:00:00 2001 From: Oli Larkin Date: Fri, 19 Jan 2024 23:51:14 +0100 Subject: [PATCH] receptive_field --- NAM/dsp.cpp | 14 +++++++------- NAM/dsp.h | 4 ++-- NAM/get_dsp.cpp | 4 ++-- NAM/wavenet.cpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NAM/dsp.cpp b/NAM/dsp.cpp index 906aa9f..8b3b871 100644 --- a/NAM/dsp.cpp +++ b/NAM/dsp.cpp @@ -62,10 +62,10 @@ void nam::DSP::Finalize(const int numFrames) {} // Buffer ===================================================================== -nam::Buffer::Buffer(const int receptive_field, const double expected_sample_rate) +nam::Buffer::Buffer(const int receptiveField, const double expected_sample_rate) : nam::DSP(expected_sample_rate) { - this->SetReceptiveField(receptive_field); + this->SetReceptiveField(receptiveField); } void nam::Buffer::SetReceptiveField(const int newReceptiveField) @@ -136,11 +136,11 @@ void nam::Buffer::Finalize(const int numFrames) // Linear ===================================================================== -nam::Linear::Linear(const int receptive_field, const bool _bias, const std::vector& weights, +nam::Linear::Linear(const int receptiveField, const bool _bias, const std::vector& weights, const double expected_sample_rate) -: nam::Buffer(receptive_field, expected_sample_rate) +: nam::Buffer(receptiveField, expected_sample_rate) { - if ((int)weights.size() != (receptive_field + (_bias ? 1 : 0))) + if ((int)weights.size() != (receptiveField + (_bias ? 1 : 0))) throw std::runtime_error( "Params vector does not match expected size based " "on architecture parameters"); @@ -148,8 +148,8 @@ nam::Linear::Linear(const int receptive_field, const bool _bias, const std::vect this->_weight.resize(this->mReceptiveField); // Pass in in reverse order so that dot products work out of the box. for (int i = 0; i < this->mReceptiveField; i++) - this->_weight(i) = weights[receptive_field - 1 - i]; - this->_bias = _bias ? weights[receptive_field] : (float)0.0; + this->_weight(i) = weights[receptiveField - 1 - i]; + this->_bias = _bias ? weights[receptiveField] : (float)0.0; } void nam::Linear::Process(float* input, float* output, const int numFrames) diff --git a/NAM/dsp.h b/NAM/dsp.h index 197930d..3ad4213 100644 --- a/NAM/dsp.h +++ b/NAM/dsp.h @@ -82,7 +82,7 @@ class DSP class Buffer : public DSP { public: - Buffer(const int receptive_field, const double expected_sample_rate = -1.0); + Buffer(const int receptiveField, const double expected_sample_rate = -1.0); void Finalize(const int numFrames); protected: @@ -104,7 +104,7 @@ class Buffer : public DSP class Linear : public Buffer { public: - Linear(const int receptive_field, const bool _bias, const std::vector& weights, + Linear(const int receptiveField, const bool _bias, const std::vector& weights, const double expected_sample_rate = -1.0); void Process(float* input, float* output, const int numFrames) override; diff --git a/NAM/get_dsp.cpp b/NAM/get_dsp.cpp index d848046..08acec4 100644 --- a/NAM/get_dsp.cpp +++ b/NAM/get_dsp.cpp @@ -145,9 +145,9 @@ std::unique_ptr get_dsp(dspData& conf) std::unique_ptr out = nullptr; if (architecture == "Linear") { - const int receptive_field = config["receptive_field"]; + const int receptiveField = config["receptiveField"]; const bool _bias = config["bias"]; - out = std::make_unique(receptive_field, _bias, weights, expectedSampleRate); + out = std::make_unique(receptiveField, _bias, weights, expectedSampleRate); } else if (architecture == "ConvNet") { diff --git a/NAM/wavenet.cpp b/NAM/wavenet.cpp index f806a54..1ce5ecc 100644 --- a/NAM/wavenet.cpp +++ b/NAM/wavenet.cpp @@ -67,10 +67,10 @@ nam::wavenet::_LayerArray::_LayerArray(const int input_size, const int condition { for (size_t i = 0; i < dilations.size(); i++) this->_layers.push_back(_Layer(condition_size, channels, kernel_size, dilations[i], activation, gated)); - const long receptive_field = this->_get_receptive_field(); + const long receptiveField = this->_get_receptive_field(); for (size_t i = 0; i < dilations.size(); i++) { - this->_layer_buffers.push_back(Eigen::MatrixXf(channels, LAYER_ARRAY_BUFFER_SIZE + receptive_field - 1)); + this->_layer_buffers.push_back(Eigen::MatrixXf(channels, LAYER_ARRAY_BUFFER_SIZE + receptiveField - 1)); this->_layer_buffers[i].setZero(); } this->_buffer_start = this->_get_receptive_field() - 1;