Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

clarify ops faq regarding docs strings #13492

Merged
merged 1 commit into from
Dec 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions docs/faq/add_op_in_backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The last line of the above code snippet is a tuple of three lists returned
by `d.infer_shape()`. The first list contains all the argument shapes
of `a`, `b`, and `c`. The second contains the output shape of `d`. The
third one represents the shapes of auxiliary states, which is not used
in this case, and thus is empty.
in this case, and thus is empty.
In this example, we only specified values for variable `a`'s first dimension
and `c`'s second dimension. The `0` in shape `(2, 0)` indicates that the size
of the second dimension is unknown, same meaning for shape `(0, 3)`.
Expand Down Expand Up @@ -437,10 +437,13 @@ NNVM_REGISTER_OP(quadratic)
where :math:`x` is an input tensor and all operations
in the function are element-wise.

Example::
x = [[1, 2], [3, 4]]
y = quadratic(data=x, a=1, b=2, c=3)
y = [[6, 11], [18, 27]]
Example:

.. code-block:: python
:emphasize-lines: 1,3
x = [[1, 2], [3, 4]]
y = quadratic(data=x, a=1, b=2, c=3)
y = [[6, 11], [18, 27]]

)code" ADD_FILELINE) // 4
.set_attr_parser(ParamParser<QuadraticParam>) // 5
Expand Down Expand Up @@ -474,8 +477,11 @@ NNVM_REGISTER_OP(_backward_quadratic)
of `Op` type and save it in the operator manager and return a reference
of the just created operator object.
- Lines 3-4: Add description as an operator attribute
including examples of the operator. The documentation engine would extract
including examples of the operator. The documentation engine will extract
this description and display it on the documentation web page.
`emphasize-lines` is optional.
For more examples and troubleshooting with doc strings, refer to the [MXNet
developer wiki's Documentation Guide](https://cwiki.apache.org/confluence/display/MXNET/Documentation+Guide).
- Line 5: Set parameter struct parser for the operator. It is used for parsing
the parameters `a`, `b`, and `c` input from frontend.
- Line 6: Set the number of inputs for the operator.
Expand Down Expand Up @@ -630,7 +636,7 @@ python tools/flakiness_checker.py test_operator.test_quadratic_function

Please note that for `check_symbolic_forward` and `check_symbolic_backward` we pass
both the operator symbols and expected results for comparison, for
`check_numeric_gradient` we only pass the operator symbol, as the
`check_numeric_gradient` we only pass the operator symbol, as the
`check_numeric_gradient` computes the expected value using finite difference
method. Which is why it is highly recommended to add `check_numeric_gradient`
test for every operator with backward function implemented as it eliminates
Expand Down