diff options
author | qipeng <pengrobertqi@163.com> | 2014-08-01 14:24:22 -0700 |
---|---|---|
committer | qipeng <pengrobertqi@163.com> | 2014-08-01 14:24:22 -0700 |
commit | 21d1d91ed63e4ffb486560c0d22278357c3aa896 (patch) | |
tree | bbb298fcb34db83ee2b474316ac927cd4729ade5 | |
parent | d78a8de102111525ae66a4536093d58823fd7129 (diff) | |
download | caffeonacl-21d1d91ed63e4ffb486560c0d22278357c3aa896.tar.gz caffeonacl-21d1d91ed63e4ffb486560c0d22278357c3aa896.tar.bz2 caffeonacl-21d1d91ed63e4ffb486560c0d22278357c3aa896.zip |
fixed unnecessary conversions in test_solver, and rearraged common.hpp a bit
-rw-r--r-- | include/caffe/common.hpp | 5 | ||||
-rw-r--r-- | src/caffe/test/test_solver.cpp | 18 |
2 files changed, 9 insertions, 14 deletions
diff --git a/include/caffe/common.hpp b/include/caffe/common.hpp index 789b3db0..d3dbd471 100644 --- a/include/caffe/common.hpp +++ b/include/caffe/common.hpp @@ -6,12 +6,11 @@ #include <boost/shared_ptr.hpp> #include <glog/logging.h> +#include <cmath> #include <map> #include <set> #include <string> -#include <cmath> - #include "caffe/util/device_alternate.hpp" // Disable the copy and assignment operator for a class. @@ -73,6 +72,7 @@ using boost::shared_ptr; // Common functions and classes from std that caffe often uses. using std::fstream; using std::ios; +using std::isnan; using std::iterator; using std::make_pair; using std::map; @@ -81,7 +81,6 @@ using std::pair; using std::set; using std::string; using std::vector; -using std::isnan; // A global initialization function that you should call in your main function. // Currently it initializes google flags and google logging. diff --git a/src/caffe/test/test_solver.cpp b/src/caffe/test/test_solver.cpp index 20bad95f..feefb512 100644 --- a/src/caffe/test/test_solver.cpp +++ b/src/caffe/test/test_solver.cpp @@ -96,18 +96,14 @@ TYPED_TEST(SolverTest, TestInitTrainTestNets) { " } " "} "; this->InitSolverFromProtoString(proto); - ASSERT_TRUE(static_cast<bool>(this->solver_->net())); - EXPECT_TRUE(static_cast<bool>(this->solver_->net()->has_layer("loss"))); - EXPECT_FALSE(static_cast<bool>(this->solver_->net()->has_layer("accuracy"))); + ASSERT_TRUE(this->solver_->net() != NULL); + EXPECT_TRUE(this->solver_->net()->has_layer("loss")); + EXPECT_FALSE(this->solver_->net()->has_layer("accuracy")); ASSERT_EQ(2, this->solver_->test_nets().size()); - EXPECT_TRUE(static_cast<bool>( - this->solver_->test_nets()[0]->has_layer("loss"))); - EXPECT_TRUE(static_cast<bool>( - this->solver_->test_nets()[0]->has_layer("accuracy"))); - EXPECT_FALSE(static_cast<bool>( - this->solver_->test_nets()[1]->has_layer("loss"))); - EXPECT_TRUE(static_cast<bool>( - this->solver_->test_nets()[1]->has_layer("accuracy"))); + EXPECT_TRUE(this->solver_->test_nets()[0]->has_layer("loss")); + EXPECT_TRUE(this->solver_->test_nets()[0]->has_layer("accuracy")); + EXPECT_FALSE(this->solver_->test_nets()[1]->has_layer("loss")); + EXPECT_TRUE(this->solver_->test_nets()[1]->has_layer("accuracy")); } } // namespace caffe |