1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include "caffe2/operators/elementwise_sub_op.h"
#include <string>
#include <vector>
namespace caffe2 {
REGISTER_CPU_OPERATOR(
SubGradient,
BinaryElementwiseGradientOp<
NumericTypes,
CPUContext,
SubFunctor<CPUContext>>);
namespace {
class GetSubGradient final : public GradientMakerBase {
using GradientMakerBase::GradientMakerBase;
std::vector<OperatorDef> GetGradientDefs() override {
return SingleGradientDef(
"SubGradient",
"",
std::vector<std::string>{GO(0), I(0), I(1)},
std::vector<std::string>{GI(0), GI(1)});
}
};
} // namespace
REGISTER_GRADIENT(Sub, GetSubGradient);
} // namespace caffe2
|