Skip to content

Commit

Permalink
Merge pull request #5184 from shaibagon/fix_batch_norm_param_upgrade
Browse files Browse the repository at this point in the history
fix harsh upgrade_proto for `"BatchNorm"` layer to zero instead of clear params
  • Loading branch information
shelhamer authored Jan 20, 2017
2 parents c86433a + a19357a commit bc0d680
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/caffe/util/upgrade_proto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,13 @@ void UpgradeNetBatchNorm(NetParameter* net_param) {
// the previous BatchNorm layer definition.
if (net_param->layer(i).type() == "BatchNorm"
&& net_param->layer(i).param_size() == 3) {
net_param->mutable_layer(i)->clear_param();
// set lr_mult and decay_mult to zero. leave all other param intact.
for (int ip = 0; ip < net_param->layer(i).param_size(); ip++) {
ParamSpec* fixed_param_spec =
net_param->mutable_layer(i)->mutable_param(ip);
fixed_param_spec->set_lr_mult(0.f);
fixed_param_spec->set_decay_mult(0.f);
}
}
}
}
Expand Down

0 comments on commit bc0d680

Please sign in to comment.