Skip to content

Commit a19357a

Browse files
author
shai
committed
fixing upgrade_proto for BatchNorm layer: be more conservative leave "name" in param, only set lr_mult and decay_mult to zero
1 parent 0a91794 commit a19357a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/caffe/util/upgrade_proto.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,13 @@ void UpgradeNetBatchNorm(NetParameter* net_param) {
10181018
// the previous BatchNorm layer definition.
10191019
if (net_param->layer(i).type() == "BatchNorm"
10201020
&& net_param->layer(i).param_size() == 3) {
1021-
net_param->mutable_layer(i)->clear_param();
1021+
// set lr_mult and decay_mult to zero. leave all other param intact.
1022+
for (int ip = 0; ip < net_param->layer(i).param_size(); ip++) {
1023+
ParamSpec* fixed_param_spec =
1024+
net_param->mutable_layer(i)->mutable_param(ip);
1025+
fixed_param_spec->set_lr_mult(0.f);
1026+
fixed_param_spec->set_decay_mult(0.f);
1027+
}
10221028
}
10231029
}
10241030
}

0 commit comments

Comments
 (0)