Caffe2 - C++ API
A deep learning, cross platform ML framework
feed_blob_op.h
1 #ifndef CAFFE2_OPERATORS_FEED_BLOB_OP_H_
2 #define CAFFE2_OPERATORS_FEED_BLOB_OP_H_
3 
4 #include "caffe2/core/context.h"
5 #include "caffe2/core/operator.h"
6 
7 namespace caffe2 {
8 
9 template <class Context>
10 class FeedBlobOp : public Operator<Context> {
11  public:
12  template <class... Args>
13  explicit FeedBlobOp(Args&&... args)
14  : Operator<Context>(std::forward<Args>(args)...) {
15  CAFFE_ENFORCE(
16  this->template HasSingleArgumentOfType<string>("value"),
17  "value argument must exist and be passed as a string");
18  value_ = this->template GetSingleArgument<string>("value", "");
19  }
20 
21  USE_OPERATOR_CONTEXT_FUNCTIONS;
22 
23  bool RunOnDevice() override {
24  *this->template Output<std::string>(0) = value_;
25  return true;
26  }
27 
28  private:
29  std::string value_;
30 };
31 
32 } // namespace caffe2
33 
34 #endif
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13