Caffe2 - C++ API
A deep learning, cross platform ML framework
tt_pad_op.cc
1 
17 #include "caffe2/experiments/operators/tt_pad_op.h"
18 
19 namespace caffe2 {
20 namespace {
21 
22 REGISTER_CPU_OPERATOR(TTPad, TTPadOp<float, CPUContext>);
23 OPERATOR_SCHEMA(TTPad).NumInputs(1).NumOutputs(2).EnforceInplace({{0, 0}});
24 
25 REGISTER_CPU_OPERATOR(TTPadGradient, TTPadGradientOp<float, CPUContext>);
26 OPERATOR_SCHEMA(TTPadGradient)
27  .NumInputs(2)
28  .NumOutputs(1)
29  .EnforceInplace({{0, 0}});
30 
31 class GetTTPadGradient : public GradientMakerBase {
32  using GradientMakerBase::GradientMakerBase;
33  vector<OperatorDef> GetGradientDefs() override {
34  return SingleGradientDef(
35  "TTPadGradient",
36  "",
37  vector<string>{GO(0), O(1)},
38  vector<string>{GI(0)},
39  Def().arg());
40  }
41 };
42 
43 REGISTER_GRADIENT(TTPad, GetTTPadGradient);
44 
45 } // namespace
46 } // namespace caffe2
Copyright (c) 2016-present, Facebook, Inc.