Caffe2 - C++ API
A deep learning, cross platform ML framework
feed_blob_op.h
1 
17 #ifndef CAFFE2_OPERATORS_FEED_BLOB_OP_H_
18 #define CAFFE2_OPERATORS_FEED_BLOB_OP_H_
19 
20 #include "caffe2/core/context.h"
21 #include "caffe2/core/operator.h"
22 
23 namespace caffe2 {
24 
25 template <class Context>
26 class FeedBlobOp : public Operator<Context> {
27  public:
28  FeedBlobOp(const OperatorDef& def, Workspace* ws)
29  : Operator<Context>(def, ws) {
30  CAFFE_ENFORCE(
31  OperatorBase::HasSingleArgumentOfType<string>("value"),
32  "value argument must exist and be passed as a string");
33  value_ = OperatorBase::GetSingleArgument<string>("value", "");
34  }
35 
36  bool RunOnDevice() override {
37  *OperatorBase::Output<std::string>(0) = value_;
38  return true;
39  }
40 
41  private:
42  std::string value_;
43 };
44 
45 } // namespace caffe2
46 
47 #endif
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.