Skip to content

Commit

Permalink
Merge pull request BVLC#129 from NVIDIA/bug-fix
Browse files Browse the repository at this point in the history
200184257 fix confirmed.
  • Loading branch information
drnikolaev committed Mar 28, 2016
2 parents cd18a08 + 9029a15 commit ceb9098
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/caffe/test/test_gradient_based_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,21 +555,25 @@ class GradientBasedSolverTest : public MultiDeviceTest<TypeParam> {
const vector<Blob<Dtype>*>& params = solver_->net()->learnable_params();
for (int i = 0; i < params.size(); ++i) {
for (int j = 0; j < params[i]->count(); ++j) {
EXPECT_EQ(param_copies[i]->cpu_data()[j], params[i]->cpu_data()[j])
<< "param " << i << " data differed at dim " << j;
EXPECT_EQ(param_copies[i]->cpu_diff()[j], params[i]->cpu_diff()[j])
<< "param " << i << " diff differed at dim " << j;
Dtype rel_error = Dtype(std::max(1., fabs(params[i]->cpu_data()[j])) *
1.e-5);
EXPECT_NEAR(param_copies[i]->cpu_data()[j], params[i]->cpu_data()[j],
rel_error) << "param " << i << " data differed at dim " << j;
EXPECT_NEAR(param_copies[i]->cpu_diff()[j], params[i]->cpu_diff()[j],
rel_error) << "param " << i << " diff differed at dim " << j;
}
}

// Check that history now matches.
const vector<shared_ptr<Blob<Dtype> > >& history = solver_->history();
for (int i = 0; i < history.size(); ++i) {
for (int j = 0; j < history[i]->count(); ++j) {
EXPECT_EQ(history_copies[i]->cpu_data()[j], history[i]->cpu_data()[j])
<< "history blob " << i << " data differed at dim " << j;
EXPECT_EQ(history_copies[i]->cpu_diff()[j], history[i]->cpu_diff()[j])
<< "history blob " << i << " diff differed at dim " << j;
Dtype rel_error = Dtype(std::max(1., fabs(history[i]->cpu_data()[j])) *
1.e-5);
EXPECT_NEAR(history_copies[i]->cpu_data()[j], history[i]->cpu_data()[j],
rel_error) << "history blob " << i << " data differed at dim " << j;
EXPECT_NEAR(history_copies[i]->cpu_diff()[j], history[i]->cpu_diff()[j],
rel_error) << "history blob " << i << " diff differed at dim " << j;
}
}
}
Expand Down

0 comments on commit ceb9098

Please sign in to comment.