| 41 | |
| 42 | template <typename Dtype> |
| 43 | void Solver<Dtype>::Init(const SolverParameter& param) { |
| 44 | LOG_IF(INFO, Caffe::root_solver()) << "Initializing solver from parameters: " |
| 45 | << std::endl << param.DebugString(); |
| 46 | param_ = param; |
| 47 | CHECK_GE(param_.average_loss(), 1) << "average_loss should be non-negative."; |
| 48 | CheckSnapshotWritePermissions(); |
| 49 | if (param_.random_seed() >= 0) { |
| 50 | Caffe::set_random_seed(param_.random_seed() + Caffe::solver_rank()); |
| 51 | } |
| 52 | // Scaffolding code |
| 53 | InitTrainNet(); |
| 54 | InitTestNets(); |
| 55 | if (Caffe::root_solver()) { |
| 56 | LOG(INFO) << "Solver scaffolding done."; |
| 57 | } |
| 58 | iter_ = 0; |
| 59 | current_step_ = 0; |
| 60 | } |
| 61 | |
| 62 | template <typename Dtype> |
| 63 | void Solver<Dtype>::InitTrainNet() { |
nothing calls this directly
no test coverage detected