mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
* Move elementwise grad ops to separate files Move elementwise grad ops to separate files * Fix proto build * Fix build * Fix sync error
34 lines
683 B
C++
34 lines
683 B
C++
#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
|