virtual void InitSolverFromProtoString(const string& proto) { SolverParameter param; CHECK(google::protobuf::TextFormat::ParseFromString(proto, ¶m)); // Set the solver_mode according to current Caffe::mode. switch (Caffe::mode()) { case Caffe::CPU: param.set_solver_mode(SolverParameter_SolverMode_CPU); break; case Caffe::GPU: param.set_solver_mode(SolverParameter_SolverMode_GPU); break; default: LOG(FATAL) << "Unknown Caffe mode: " << Caffe::mode(); } solver_.reset(new SGDSolver<Dtype>(param)); }
virtual void InitSolverFromProtoString(const string& proto) { SolverParameter param; CHECK(google::protobuf::TextFormat::ParseFromString(proto, ¶m)); // Disable saving a final snapshot so the tests don't pollute the user's // working directory with useless snapshots. param.set_snapshot_after_train(false); // Set the solver_mode according to current Caffe::mode. switch (Caffe::mode()) { case Caffe::CPU: param.set_solver_mode(SolverParameter_SolverMode_CPU); break; case Caffe::GPU: param.set_solver_mode(SolverParameter_SolverMode_GPU); break; default: LOG(FATAL) << "Unknown Caffe mode: " << Caffe::mode(); } solver_.reset(new MockSGDSolver(param)); }
virtual void InitSolverFromProtoString(const string& proto) { SolverParameter param; CHECK(google::protobuf::TextFormat::ParseFromString(proto, ¶m)); // Set the solver_mode according to current Caffe::mode. switch (Caffe::mode()) { case Caffe::CPU: param.set_solver_mode(SolverParameter_SolverMode_CPU); break; case Caffe::GPU: param.set_solver_mode(SolverParameter_SolverMode_GPU); break; default: LOG(FATAL) << "Unknown Caffe mode: " << Caffe::mode(); } InitSolver(param); delta_ = (solver_type() == SolverParameter_SolverType_ADAGRAD || solver_type() == SolverParameter_SolverType_RMSPROP) ? param.delta() : 0; }