mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
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
36 lines
726 B
C++
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
|