Ejemplo n.º 1
0
 virtual void InitSolverFromProtoString(const string& proto) {
   SolverParameter param;
   CHECK(google::protobuf::TextFormat::ParseFromString(proto, &param));
   // 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));
 }
Ejemplo n.º 2
0
 virtual void InitSolverFromProtoString(const string& proto) {
   SolverParameter param;
   CHECK(google::protobuf::TextFormat::ParseFromString(proto, &param));
   // 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));
 }
Ejemplo n.º 3
0
 virtual void InitSolverFromProtoString(const string& proto) {
   SolverParameter param;
   CHECK(google::protobuf::TextFormat::ParseFromString(proto, &param));
   // 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;
 }