Caffe2 - C++ API
A deep learning, cross platform ML framework
free_op.h
1 
17 #ifndef CAFFE2_OPERATORS_FREE_OP_H_
18 #define CAFFE2_OPERATORS_FREE_OP_H_
19 
20 #include "caffe2/core/context.h"
21 #include "caffe2/core/operator.h"
22 
23 namespace caffe2 {
24 
25 // FreeOp frees the content of the output blob. We allow it to take in input
26 // blobs purely for the reason that it can "wait" on the input blobs to be
27 // produced by some of the earlier operators before a free is called.
28 template <class Context>
29 class FreeOp : public Operator<Context> {
30  public:
31  FreeOp(const OperatorDef& def, Workspace* ws) : Operator<Context>(def, ws) {}
32 
33  bool RunOnDevice() override {
34  for (Blob* output : OperatorBase::Outputs()) {
35  output->Reset();
36  }
37  return true;
38  }
39 };
40 
41 } // namespace caffe2
42 
43 #endif // CAFFE2_OPERATORS_FREE_OP_H_
Blob is a general container that hosts a typed pointer.
Definition: blob.h:41
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.