pytorch/caffe2/operators/elementwise_mul_gradient_op.cc
Mark Santaniello 20fc7b6ec7 Avoid undefined symbol error when building AdIndexer LTO (#19009)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19009

Move the definition of `MulFunctor<>::Backward()` into a header file.

Reviewed By: BIT-silence

Differential Revision: D14823230

fbshipit-source-id: 1efaec01863fcc02dcbe7e788d376e72f8564501
2019-04-15 23:43:13 -07:00

36 lines
726 B
C++

#include "caffe2/operators/elementwise_mul_op.h"
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
namespace caffe2 {
REGISTER_CPU_OPERATOR(
MulGradient,
BinaryElementwiseGradientOp<
NumericTypes,
CPUContext,
MulFunctor<CPUContext>>);
namespace {
class GetMulGradient final : public GradientMakerBase {
using GradientMakerBase::GradientMakerBase;
std::vector<OperatorDef> GetGradientDefs() override {
return SingleGradientDef(
"MulGradient",
"",
std::vector<std::string>{GO(0), I(0), I(1)},
std::vector<std::string>{GI(0), GI(1)});
}
};
} // namespace
REGISTER_GRADIENT(Mul, GetMulGradient);
} // namespace caffe2