Caffe2 - C++ API
A deep learning, cross platform ML framework
channel_shuffle_op.cc
1 
17 #include "channel_shuffle_op.h"
18 
19 namespace caffe2 {
20 
22  using GradientMakerBase::GradientMakerBase;
23  vector<OperatorDef> GetGradientDefs() override {
24  return SingleGradientDef(
25  def_.type() + "Gradient",
26  "",
27  vector<string>{GO(0)},
28  vector<string>{GI(0)});
29  }
30 };
31 
32 REGISTER_CPU_OPERATOR(ChannelShuffle, ChannelShuffleOp<CPUContext>);
33 REGISTER_CPU_OPERATOR(
34  ChannelShuffleGradient,
36 REGISTER_GRADIENT(ChannelShuffle, GetChannelShuffleGradient);
37 OPERATOR_SCHEMA(ChannelShuffle)
38  .IdenticalTypeAndShape()
39  .NumInputs(1)
40  .NumOutputs(1);
41 OPERATOR_SCHEMA(ChannelShuffleGradient)
42  .IdenticalTypeAndShape()
43  .NumInputs(1)
44  .NumOutputs(1);
45 }
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 ...