Skip to content

Commit

Permalink
Fix incorrect computation of accum grad
Browse files Browse the repository at this point in the history
param decay should be accumulated after applying learning rate.
  • Loading branch information
tnarihi committed Mar 12, 2015
1 parent 7197702 commit a01dfbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/caffe/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ void SGDSolver<Dtype>::ComputeUpdateValue() {
// Compute the value to history, and then copy them to the blob's diff.
Dtype local_rate = rate * net_params_lr[param_id]
/ this->param_.iter_size();
Dtype local_decay = weight_decay * net_params_weight_decay[param_id];
Dtype local_decay = weight_decay * net_params_weight_decay[param_id]
* this->param_.iter_size();

if (local_decay) {
if (regularization_type == "L2") {
Expand Down Expand Up @@ -535,7 +536,8 @@ void SGDSolver<Dtype>::ComputeUpdateValue() {
// Compute the value to history, and then copy them to the blob's diff.
Dtype local_rate = rate * net_params_lr[param_id]
/ this->param_.iter_size();
Dtype local_decay = weight_decay * net_params_weight_decay[param_id];
Dtype local_decay = weight_decay * net_params_weight_decay[param_id]
* this->param_.iter_size();

if (local_decay) {
if (regularization_type == "L2") {
Expand Down

0 comments on commit a01dfbf

Please sign in to comment.