Caffe2 - C++ API
A deep learning, cross platform ML framework
fully_connected_op_decomposition.cc
1 
17 #include "caffe2/experiments/operators/fully_connected_op_decomposition.h"
18 
19 namespace caffe2 {
20 
21 REGISTER_CPU_OPERATOR(FC_Decomp, FullyConnectedOpDecomp<float, CPUContext>);
22 REGISTER_CPU_OPERATOR(FCGradient_Decomp,
23  FullyConnectedDecompGradientOp<float, CPUContext>);
24 
25 OPERATOR_SCHEMA(FC_Decomp).NumInputs(4).NumOutputs(1);
26 OPERATOR_SCHEMA(FCGradient_Decomp).NumInputs(4).NumOutputs(3, 4);
27 
29  using GradientMakerBase::GradientMakerBase;
30  vector<OperatorDef> GetGradientDefs() override {
31  CAFFE_ENFORCE_EQ(def_.input_size(), 4);
32  // TODO(wyiming): Check whether it is right? Let's move fast first.
33  return SingleGradientDef(
34  "FCGradient_Decomp", "",
35  vector<string>{I(0), I(1), I(2), GO(0)},
36  vector<string>{GI(1), GI(2), GI(3), GI(0)});
37  }
38 };
39 REGISTER_GRADIENT(FC_Decomp, GetFCDecompGradient);
40 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.
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 ...