Caffe2 - C++ API
A deep learning, cross platform ML framework
fully_connected_op_decomposition.cc
1 #include "caffe2/experiments/operators/fully_connected_op_decomposition.h"
2 
3 namespace caffe2 {
4 
5 REGISTER_CPU_OPERATOR(FC_Decomp, FullyConnectedOpDecomp<float, CPUContext>);
6 REGISTER_CPU_OPERATOR(FCGradient_Decomp,
7  FullyConnectedDecompGradientOp<float, CPUContext>);
8 
9 OPERATOR_SCHEMA(FC_Decomp).NumInputs(4).NumOutputs(1);
10 OPERATOR_SCHEMA(FCGradient_Decomp).NumInputs(4).NumOutputs(3, 4);
11 
13  using GradientMakerBase::GradientMakerBase;
14  vector<OperatorDef> GetGradientDefs() override {
15  CAFFE_ENFORCE_EQ(def_.input_size(), 4);
16  // TODO(wyiming): Check whether it is right? Let's move fast first.
17  return SingleGradientDef(
18  "FCGradient_Decomp", "",
19  vector<string>{I(0), I(1), I(2), GO(0)},
20  vector<string>{GI(1), GI(2), GI(3), GI(0)});
21  }
22 };
23 REGISTER_GRADIENT(FC_Decomp, GetFCDecompGradient);
24 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
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 ...