From a01dfbfd5469d43fbdd6e59dbee8e905c4eab269 Mon Sep 17 00:00:00 2001 From: Takuya Narihira Date: Thu, 26 Feb 2015 19:24:36 -0800 Subject: [PATCH] Fix incorrect computation of accum grad param decay should be accumulated after applying learning rate. --- src/caffe/solver.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/caffe/solver.cpp b/src/caffe/solver.cpp index affbf149ac4..3594777e5db 100644 --- a/src/caffe/solver.cpp +++ b/src/caffe/solver.cpp @@ -498,7 +498,8 @@ void SGDSolver::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") { @@ -535,7 +536,8 @@ void SGDSolver::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") {