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

Added missing SetZero() to NaturalGradientAffineComponent::Scale() if… #1522

Merged
merged 1 commit into from Mar 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/nnet3/nnet-simple-component.cc
Expand Up @@ -2798,11 +2798,19 @@ void NaturalGradientAffineComponent::ZeroStats() {
}

void NaturalGradientAffineComponent::Scale(BaseFloat scale) {
update_count_ *= scale;
max_change_scale_stats_ *= scale;
active_scaling_count_ *= scale;
linear_params_.Scale(scale);
bias_params_.Scale(scale);
if (scale == 0.0) {
update_count_ = 0.0;
max_change_scale_stats_ = 0.0;
active_scaling_count_ = 0.0;
linear_params_.SetZero();
bias_params_.SetZero();
} else {
update_count_ *= scale;
max_change_scale_stats_ *= scale;
active_scaling_count_ *= scale;
linear_params_.Scale(scale);
bias_params_.Scale(scale);
}
}

void NaturalGradientAffineComponent::Add(BaseFloat alpha, const Component &other_in) {
Expand Down