Caffe2 - C++ API
A deep learning, cross platform ML framework
file_store_handler_op.h
1 #pragma once
2 
3 #include "file_store_handler.h"
4 
5 #include <caffe2/core/operator.h>
6 
7 namespace caffe2 {
8 
9 template <class Context>
10 class FileStoreHandlerCreateOp final : public Operator<Context> {
11  public:
12  explicit FileStoreHandlerCreateOp(
13  const OperatorDef& operator_def,
14  Workspace* ws)
15  : Operator<Context>(operator_def, ws),
16  basePath_(
17  OperatorBase::template GetSingleArgument<std::string>("path", "")),
18  prefix_(OperatorBase::template GetSingleArgument<std::string>(
19  "prefix",
20  "")) {
21  CAFFE_ENFORCE_NE(basePath_, "", "path is a required argument");
22  }
23 
24  bool RunOnDevice() override {
25  auto ptr =
26  std::unique_ptr<StoreHandler>(new FileStoreHandler(basePath_, prefix_));
27  *OperatorBase::Output<std::unique_ptr<StoreHandler>>(HANDLER) =
28  std::move(ptr);
29  return true;
30  }
31 
32  private:
33  std::string basePath_;
34  std::string prefix_;
35 
36  OUTPUT_TAGS(HANDLER);
37 };
38 
39 } // namespace caffe2
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:47
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13