Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Fix gated activations in WaveNet #131

Merged
merged 3 commits into from
Oct 20, 2024
Merged
Changes from 1 commit
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
Next Next commit
Possible fix to gating bug. Haven't tried, needs tests
sdatkinson committed Oct 20, 2024
commit 383a41236a3baf35a16923800f34839f394ec9b1
13 changes: 9 additions & 4 deletions NAM/wavenet.cpp
Original file line number Diff line number Diff line change
@@ -37,10 +37,15 @@ void nam::wavenet::_Layer::process_(const Eigen::MatrixXf& input, const Eigen::M
}
else
{
this->_activation->apply(this->_z.topRows(channels));
activations::Activation::get_activation("Sigmoid")->apply(this->_z.bottomRows(channels));
// activations::Activation::get_activation("Sigmoid")->apply(this->_z.block(channels, 0, channels,
// this->_z.cols()));
// CAREFUL: .topRows() and .bottomRows() won't be memory-contiguous for a column-major matrix (Issue 125). Need to
// do this column-wise:
for (long i = 0; i < _z.cols(); i++)
{
this->_activation->apply(this->_z.block(0, i, channels, 1));
activations::Activation::get_activation("Sigmoid")->apply(this->_z.block(channels, i, channels, 1));
// activations::Activation::get_activation("Sigmoid")->apply(this->_z.block(channels, 0, channels,
// this->_z.cols()));
}

this->_z.topRows(channels).array() *= this->_z.bottomRows(channels).array();
// this->_z.topRows(channels) = this->_z.topRows(channels).cwiseProduct(