1 #include "caffe2/operators/rowmul_op.h" 6 REGISTER_CPU_OPERATOR(ReduceTailSum, ReduceTailSumOp<float, CPUContext>);
7 REGISTER_CPU_OPERATOR(RowMul, RowMulOp<float, CPUContext>);
9 OPERATOR_SCHEMA(ReduceTailSum)
13 Reduce the tailing dimensions 15 .Input(0, "mat",
"The matrix")
16 .Output(0,
"output",
"Output");
18 OPERATOR_SCHEMA(RowMul)
22 Given a matrix A and column vector w, the output is the multiplication of row i 23 of A and element i of w, e.g. C[i][j] = A[i][j] * w[i]. This operator should be 24 deprecated when the gradient operator of Mul with broadcast is implemented. 26 .Input(0, "mat",
"The matrix")
27 .Input(1,
"w",
"The column vector")
28 .Output(0,
"output",
"Output");
30 class GetRowMulGradient :
public GradientMakerBase {
31 using GradientMakerBase::GradientMakerBase;
32 vector<OperatorDef> GetGradientDefs()
override {
33 return vector<OperatorDef>{
35 "RowMul",
"", vector<string>{GO(0), I(1)}, vector<string>{GI(0)}),
39 vector<string>{GO(0), I(0)},
40 vector<string>{GI(1) +
"before_aggregate"}),
44 vector<string>{GI(1) +
"before_aggregate"},
45 vector<string>{GI(1)})};
48 REGISTER_GRADIENT(RowMul, GetRowMulGradient);
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...