Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Fix bug scale_layer when cpu forward
Browse files Browse the repository at this point in the history
  • Loading branch information
wyg1997 committed Oct 30, 2019
1 parent ed05614 commit 187e248
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/caffe/layers/scale_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ void ScaleLayer<Dtype>::Forward_cpu(
// Note that this is only necessary for Backward; we could skip this if not
// doing Backward, but Caffe currently provides no way of knowing whether
// we'll need to do Backward at the time of the Forward call.
caffe_copy(bottom[0]->count(), bottom[0]->cpu_data(),
temp_.mutable_cpu_data());
const bool scale_param = (bottom.size() == 1);
if (!scale_param || (scale_param && this->param_propagate_down_[0])) {
caffe_copy(bottom[0]->count(), bottom[0]->gpu_data(),
temp_.mutable_cpu_data());
}
}
const Dtype* scale_data =
((bottom.size() > 1) ? bottom[1] : this->blobs_[0].get())->cpu_data();
Expand Down

0 comments on commit 187e248

Please sign in to comment.