diff --git a/NAM/convnet.h b/NAM/convnet.h index b1fa142..458cf67 100644 --- a/NAM/convnet.h +++ b/NAM/convnet.h @@ -22,7 +22,7 @@ namespace convnet class BatchNorm { public: - BatchNorm(){}; + BatchNorm() {}; BatchNorm(const int dim, std::vector::iterator& weights); void process_(Eigen::MatrixXf& input, const long i_start, const long i_end) const; @@ -39,7 +39,7 @@ class BatchNorm class ConvNetBlock { public: - ConvNetBlock(){}; + ConvNetBlock() {}; void set_weights_(const int in_channels, const int out_channels, const int _dilation, const bool batchnorm, const std::string activation, std::vector::iterator& weights); void process_(const Eigen::MatrixXf& input, Eigen::MatrixXf& output, const long i_start, const long i_end) const; @@ -55,7 +55,7 @@ class ConvNetBlock class _Head { public: - _Head(){}; + _Head() {}; _Head(const int channels, std::vector::iterator& weights); void process_(const Eigen::MatrixXf& input, Eigen::VectorXf& output, const long i_start, const long i_end) const; diff --git a/NAM/wavenet.h b/NAM/wavenet.h index a2ad2fc..adbf306 100644 --- a/NAM/wavenet.h +++ b/NAM/wavenet.h @@ -29,7 +29,7 @@ class _Layer , _input_mixin(condition_size, gated ? 2 * channels : channels, false) , _1x1(channels, channels, true) , _activation(activations::Activation::get_activation(activation)) - , _gated(gated){}; + , _gated(gated) {}; void set_weights_(std::vector::iterator& weights); // :param `input`: from previous layer // :param `output`: to next layer @@ -170,9 +170,15 @@ class WaveNet : public DSP WaveNet(const std::vector& layer_array_params, const float head_scale, const bool with_head, std::vector weights, const double expected_sample_rate = -1.0); ~WaveNet() = default; - + void process(NAM_SAMPLE* input, NAM_SAMPLE* output, const int num_frames) override; void set_weights_(std::vector& weights); +protected: + // Element-wise arrays: + Eigen::MatrixXf _condition; + // Fill in the "condition" array that's fed into the various parts of the net. + virtual void _set_condition_array(NAM_SAMPLE* input, const int num_frames); + private: long _num_frames; std::vector<_LayerArray> _layer_arrays; @@ -180,8 +186,6 @@ class WaveNet : public DSP std::vector _layer_array_outputs; // Head _head; - // Element-wise arrays: - Eigen::MatrixXf _condition; // One more than total layer arrays std::vector _head_arrays; float _head_scale; @@ -189,11 +193,8 @@ class WaveNet : public DSP void _advance_buffers_(const int num_frames); void _prepare_for_frames_(const long num_frames); - void process(NAM_SAMPLE* input, NAM_SAMPLE* output, const int num_frames) override; virtual int _get_condition_dim() const { return 1; }; - // Fill in the "condition" array that's fed into the various parts of the net. - virtual void _set_condition_array(NAM_SAMPLE* input, const int num_frames); // Ensure that all buffer arrays are the right size for this num_frames void _set_num_frames_(const long num_frames);