Caffe2 - C++ API
A deep learning, cross platform ML framework
run_plan.cc
1 
17 #include "caffe2/core/init.h"
18 #include "caffe2/core/operator.h"
19 #include "caffe2/proto/caffe2.pb.h"
20 #include "caffe2/utils/proto_utils.h"
21 #include "caffe2/core/logging.h"
22 
23 CAFFE2_DEFINE_string(plan, "", "The given path to the plan protobuffer.");
24 
25 int main(int argc, char** argv) {
26  caffe2::GlobalInit(&argc, &argv);
27  if (caffe2::FLAGS_plan.size() == 0) {
28  LOG(ERROR) << "No plan specified. Use --plan=/path/to/plan.";
29  return 0;
30  }
31  LOG(INFO) << "Loading plan: " << caffe2::FLAGS_plan;
32  caffe2::PlanDef plan_def;
33  CAFFE_ENFORCE(ReadProtoFromFile(caffe2::FLAGS_plan, &plan_def));
34  std::unique_ptr<caffe2::Workspace> workspace(new caffe2::Workspace());
35  workspace->RunPlan(plan_def);
36 
37  // This is to allow us to use memory leak checks.
38  google::protobuf::ShutdownProtobufLibrary();
39  return 0;
40 }
bool GlobalInit(int *pargc, char ***pargv)
Initialize the global environment of caffe2.
Definition: init.cc:34
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:63