Skip to content

Commit

Permalink
Update net.cpp
Browse files Browse the repository at this point in the history
Fixed bug raised by @tdomhan in issue BVLC#100.
  • Loading branch information
Yangqing committed Feb 13, 2014
1 parent 32d2b52 commit a302daf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/caffe/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ void Net<Dtype>::Init(const NetParameter& param) {
<< top_vecs_[i][topid]->height() << " "
<< top_vecs_[i][topid]->width();
}
// Check if this layer needs backward operation itself
for (int j = 0; j < layers_[i]->layer_param().blobs_lr_size(); ++j) {
need_backward |= (layers_[i]->layer_param().blobs_lr(j) > 0);
// catch: if a layer param does not specify blobs_lr, we should assume the
// learning rate to be 1. Thus we will need to perform backward.
if (layers_[i]->layer_param().blobs_lr_size()) {
// Check if this layer needs backward operation itself
for (int j = 0; j < layers_[i]->layer_param().blobs_lr_size(); ++j) {
need_backward |= (layers_[i]->layer_param().blobs_lr(j) > 0);
}
} else {
need_backward = true;
}
// Finally, set the backward flag
layer_need_backward_.push_back(need_backward);
Expand Down

0 comments on commit a302daf

Please sign in to comment.