Caffe2 - C++ API
A deep learning, cross platform ML framework
free_op.h
1 #ifndef CAFFE2_OPERATORS_FREE_OP_H_
2 #define CAFFE2_OPERATORS_FREE_OP_H_
3 
4 #include "caffe2/core/context.h"
5 #include "caffe2/core/operator.h"
6 
7 namespace caffe2 {
8 
9 // FreeOp frees the content of the output blob. We allow it to take in input
10 // blobs purely for the reason that it can "wait" on the input blobs to be
11 // produced by some of the earlier operators before a free is called.
12 template <class Context>
13 class FreeOp : public Operator<Context> {
14  public:
15  FreeOp(const OperatorDef& def, Workspace* ws) : Operator<Context>(def, ws) {}
16 
17  bool RunOnDevice() override {
18  for (Blob* output : OperatorBase::Outputs()) {
19  output->Reset();
20  }
21  return true;
22  }
23 };
24 
25 } // namespace caffe2
26 
27 #endif // CAFFE2_OPERATORS_FREE_OP_H_
Blob is a general container that hosts a typed pointer.
Definition: blob.h:25
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 ...