Skip to content

Commit

Permalink
Update solver.cpp
Browse files Browse the repository at this point in the history
Added these two conditions before trying SetDevice
param_.solver_mode() && param_.has_device_id()
  • Loading branch information
sguada committed Feb 3, 2014
1 parent 5962c59 commit 55cd18d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/caffe/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Solver<Dtype>::Solver(const SolverParameter& param)
template <typename Dtype>
void Solver<Dtype>::Solve(const char* resume_file) {
Caffe::set_mode(Caffe::Brew(param_.solver_mode()));
if (param_.solver_mode()) {
if (param_.solver_mode() && param_.has_device_id()) {
Caffe::SetDevice(param_.device_id());
}
Caffe::set_phase(Caffe::TRAIN);
Expand Down

0 comments on commit 55cd18d

Please sign in to comment.