The function take a `OpDesc` of the forward operator and return one or many gradient operator descriptions.
The function takes an `OpDescBind` of the forward operator and returns one or many gradient operator descriptions. `OpDescBind` is a C++ wrapper for protobuf message `OpDesc` to manipulate `OpDesc` fast.
The `GradOpDescMaker` will be registered in `OpInfo`, to replace `grad_op_type_` field. The `OpInfo` should be
The `grad_op_maker_ ` is `nullptr` if the operator does not have associated gradient operators.
We propose a base class called `GradOpDescMakerBase` to let operator developers generate `Gradient Operators` easily. The public interface of that class is
We can write many helper functions since the `GradOpDescMakerBase` is a class now. The basic helper functions get the variables of `Input`, `Output`, `InputGradient` and `OutputGradient` in the forwarding operator.
We should chagne register macros at the same time. In the current solution, there is no difference between forwarding operators and backward operators. So `REGISTER_OP` just register one operator. If the `REGISTER_OPERATOR ` contains `OpProtoAndCheckerMaker` and `GradOpDescMaker`, we just list them in the same macro. It can be done by a macro contains `__VA_ARGS__`.
<p>The function take a <codeclass="docutils literal"><spanclass="pre">OpDesc</span></code> of the forward operator and return one or many gradient operator descriptions.</p>
<p>The function takes an <codeclass="docutils literal"><spanclass="pre">OpDescBind</span></code> of the forward operator and returns one or many gradient operator descriptions. <codeclass="docutils literal"><spanclass="pre">OpDescBind</span></code> is a C++ wrapper for protobuf message <codeclass="docutils literal"><spanclass="pre">OpDesc</span></code> to manipulate <codeclass="docutils literal"><spanclass="pre">OpDesc</span></code> fast.</p>
<p>The <codeclass="docutils literal"><spanclass="pre">GradOpDescMaker</span></code> will be registered in <codeclass="docutils literal"><spanclass="pre">OpInfo</span></code>, to replace <codeclass="docutils literal"><spanclass="pre">grad_op_type_</span></code> field. The <codeclass="docutils literal"><spanclass="pre">OpInfo</span></code> should be</p>
<p>The <codeclass="docutils literal"><spanclass="pre">grad_op_maker_</span></code> is <codeclass="docutils literal"><spanclass="pre">nullptr</span></code> if the operator does not have associated gradient operators.</p>
<p>We propose a base class called <codeclass="docutils literal"><spanclass="pre">GradOpDescMakerBase</span></code> to let operator developers generate <codeclass="docutils literal"><spanclass="pre">Gradient</span><spanclass="pre">Operators</span></code> easily. The public interface of that class is</p>
<p>We can convert <codeclass="docutils literal"><spanclass="pre">GradOpDescMakerBase</span></code> to <codeclass="docutils literal"><spanclass="pre">std::function<std::vector<std::unique_ptr<OpDescBind>>(const</span><spanclass="pre">OpDescBind&)></span></code> by</p>
<p>We can write many helper functions since the <codeclass="docutils literal"><spanclass="pre">GradOpDescMakerBase</span></code> is a class now. The basic helper functions get the variables of <codeclass="docutils literal"><spanclass="pre">Input</span></code>, <codeclass="docutils literal"><spanclass="pre">Output</span></code>, <codeclass="docutils literal"><spanclass="pre">InputGradient</span></code> and <codeclass="docutils literal"><spanclass="pre">OutputGradient</span></code> in the forwarding operator.</p>
<p>We should chagne register macros at the same time. In the current solution, there is no difference between forwarding operators and backward operators. So <codeclass="docutils literal"><spanclass="pre">REGISTER_OP</span></code> just register one operator. If the <codeclass="docutils literal"><spanclass="pre">REGISTER_OPERATOR</span></code> contains <codeclass="docutils literal"><spanclass="pre">OpProtoAndCheckerMaker</span></code> and <codeclass="docutils literal"><spanclass="pre">GradOpDescMaker</span></code>, we just list them in the same macro. It can be done by a macro contains <codeclass="docutils literal"><spanclass="pre">__VA_ARGS__</span></code>.</p>
The function take a `OpDesc` of the forward operator and return one or many gradient operator descriptions.
The function takes an `OpDescBind` of the forward operator and returns one or many gradient operator descriptions. `OpDescBind` is a C++ wrapper for protobuf message `OpDesc` to manipulate `OpDesc` fast.
The `GradOpDescMaker` will be registered in `OpInfo`, to replace `grad_op_type_` field. The `OpInfo` should be
The `grad_op_maker_ ` is `nullptr` if the operator does not have associated gradient operators.
We propose a base class called `GradOpDescMakerBase` to let operator developers generate `Gradient Operators` easily. The public interface of that class is
We can write many helper functions since the `GradOpDescMakerBase` is a class now. The basic helper functions get the variables of `Input`, `Output`, `InputGradient` and `OutputGradient` in the forwarding operator.
We should chagne register macros at the same time. In the current solution, there is no difference between forwarding operators and backward operators. So `REGISTER_OP` just register one operator. If the `REGISTER_OPERATOR ` contains `OpProtoAndCheckerMaker` and `GradOpDescMaker`, we just list them in the same macro. It can be done by a macro contains `__VA_ARGS__`.
<p>The function take a <codeclass="docutils literal"><spanclass="pre">OpDesc</span></code> of the forward operator and return one or many gradient operator descriptions.</p>
<p>The function takes an <codeclass="docutils literal"><spanclass="pre">OpDescBind</span></code> of the forward operator and returns one or many gradient operator descriptions. <codeclass="docutils literal"><spanclass="pre">OpDescBind</span></code> is a C++ wrapper for protobuf message <codeclass="docutils literal"><spanclass="pre">OpDesc</span></code> to manipulate <codeclass="docutils literal"><spanclass="pre">OpDesc</span></code> fast.</p>
<p>The <codeclass="docutils literal"><spanclass="pre">GradOpDescMaker</span></code> will be registered in <codeclass="docutils literal"><spanclass="pre">OpInfo</span></code>, to replace <codeclass="docutils literal"><spanclass="pre">grad_op_type_</span></code> field. The <codeclass="docutils literal"><spanclass="pre">OpInfo</span></code> should be</p>
<p>The <codeclass="docutils literal"><spanclass="pre">grad_op_maker_</span></code> is <codeclass="docutils literal"><spanclass="pre">nullptr</span></code> if the operator does not have associated gradient operators.</p>
<p>We propose a base class called <codeclass="docutils literal"><spanclass="pre">GradOpDescMakerBase</span></code> to let operator developers generate <codeclass="docutils literal"><spanclass="pre">Gradient</span><spanclass="pre">Operators</span></code> easily. The public interface of that class is</p>
<p>We can convert <codeclass="docutils literal"><spanclass="pre">GradOpDescMakerBase</span></code> to <codeclass="docutils literal"><spanclass="pre">std::function<std::vector<std::unique_ptr<OpDescBind>>(const</span><spanclass="pre">OpDescBind&)></span></code> by</p>
<p>We can write many helper functions since the <codeclass="docutils literal"><spanclass="pre">GradOpDescMakerBase</span></code> is a class now. The basic helper functions get the variables of <codeclass="docutils literal"><spanclass="pre">Input</span></code>, <codeclass="docutils literal"><spanclass="pre">Output</span></code>, <codeclass="docutils literal"><spanclass="pre">InputGradient</span></code> and <codeclass="docutils literal"><spanclass="pre">OutputGradient</span></code> in the forwarding operator.</p>
<p>We should chagne register macros at the same time. In the current solution, there is no difference between forwarding operators and backward operators. So <codeclass="docutils literal"><spanclass="pre">REGISTER_OP</span></code> just register one operator. If the <codeclass="docutils literal"><spanclass="pre">REGISTER_OPERATOR</span></code> contains <codeclass="docutils literal"><spanclass="pre">OpProtoAndCheckerMaker</span></code> and <codeclass="docutils literal"><spanclass="pre">GradOpDescMaker</span></code>, we just list them in the same macro. It can be done by a macro contains <codeclass="docutils literal"><spanclass="pre">__VA_ARGS__</span></code>.</p>