pytorch/caffe2/operators/negate_gradient_op.cc
Kazuaki Ishizaki 601e7dc0bb Fix typos under caffe2/operators directory (#98235)
This PR fixes typos in comments and messages of `.cc` and `.h` files under `caffe2/operators` directory

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98235
Approved by: https://github.com/kit1980
2023-04-05 06:26:01 +00:00

27 lines
801 B
C++

#include "caffe2/operators/negate_gradient_op.h"
namespace caffe2 {
REGISTER_CPU_OPERATOR(NegateGradient, NegateGradientOp<CPUContext>);
OPERATOR_SCHEMA(NegateGradient)
.NumInputs(1)
.NumOutputs(1)
.AllowInplace({{0, 0}})
.SetDoc(R"DOC(
NegateGradient operator in forward pass simply copies input to the
output, and in backward pass, flips the sign of the output gradient
)DOC");
struct GetNegateGradientGradient : public GradientMakerBase {
using GradientMakerBase::GradientMakerBase;
std::vector<OperatorDef> GetGradientDefs() override {
CAFFE_ENFORCE_EQ(def_.input_size(), 1);
return SingleGradientDef(
"Negative", "", vector<string>{GO(0)}, vector<string>{GI(0)});
}
};
REGISTER_GRADIENT(NegateGradient, GetNegateGradientGradient);
} // namespace caffe2