Caffe2 - C++ API
A deep learning, cross platform ML framework
zero_gradient_op.cc
1 #include "caffe2/operators/zero_gradient_op.h"
2 
3 namespace caffe2 {
4 
5 REGISTER_CPU_OPERATOR(ZeroGradient, ZeroGradientOp<CPUContext>);
6 OPERATOR_SCHEMA(ZeroGradient)
7  .NumInputs(1)
8  .NumOutputs(0)
9  .SetDoc(R"DOC(
10 ZeroGradient operators doesn't produce any output blobs. One can use
11 this operator to produce 0 gradient for the input blob.
12 )DOC");
13 
15  using GradientMakerBase::GradientMakerBase;
16  std::vector<OperatorDef> GetGradientDefs() override {
17  return SingleGradientDef(
18  "ConstantFill",
19  "",
20  vector<string>{I(0)},
21  vector<string>{GI(0)},
22  vector<Argument>{MakeArgument<float>("value", 0.0)});
23  }
24 };
25 
26 REGISTER_GRADIENT(ZeroGradient, GetZeroGradientOpGradient);
27 
28 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13
static vector< OperatorDef > SingleGradientDef(const Args &...args)
a helper function to allow one to create one single operator def, which is usually the case for many ...