Caffe2 - C++ API
A deep learning, cross platform ML framework
file_store_handler_op.h
1 
17 #pragma once
18 
19 #include "file_store_handler.h"
20 
21 #include <caffe2/core/operator.h>
22 
23 namespace caffe2 {
24 
25 template <class Context>
26 class FileStoreHandlerCreateOp final : public Operator<Context> {
27  public:
28  explicit FileStoreHandlerCreateOp(
29  const OperatorDef& operator_def,
30  Workspace* ws)
31  : Operator<Context>(operator_def, ws),
32  basePath_(
33  OperatorBase::template GetSingleArgument<std::string>("path", "")),
34  prefix_(OperatorBase::template GetSingleArgument<std::string>(
35  "prefix",
36  "")) {
37  CAFFE_ENFORCE_NE(basePath_, "", "path is a required argument");
38  }
39 
40  bool RunOnDevice() override {
41  auto ptr =
42  std::unique_ptr<StoreHandler>(new FileStoreHandler(basePath_, prefix_));
43  *OperatorBase::Output<std::unique_ptr<StoreHandler>>(HANDLER) =
44  std::move(ptr);
45  return true;
46  }
47 
48  private:
49  std::string basePath_;
50  std::string prefix_;
51 
52  OUTPUT_TAGS(HANDLER);
53 };
54 
55 } // namespace caffe2
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
Definition: workspace.h:63
Copyright (c) 2016-present, Facebook, Inc.