Skip to content

Commit 29b2693

Browse files
authored
Merge pull request #7445 from abhinavarora/api_doc_bug
Fix the documentation for elementwise op in fluid layers
2 parents e0ae76f + f784dae commit 29b2693

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed

doc/api/v2/fluid/layers.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ elementwise_add
3838
.. autofunction:: paddle.v2.fluid.layers.elementwise_add
3939
:noindex:
4040

41+
elementwise_sub
42+
---------------
43+
.. autofunction:: paddle.v2.fluid.layers.elementwise_sub
44+
:noindex:
45+
46+
elementwise_mul
47+
---------------
48+
.. autofunction:: paddle.v2.fluid.layers.elementwise_mul
49+
:noindex:
50+
4151
elementwise_div
4252
---------------
4353
.. autofunction:: paddle.v2.fluid.layers.elementwise_div

paddle/operators/elementwise_add_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ElementwiseAddOpMaker : public ElementwiseOpMaker {
2121
public:
2222
ElementwiseAddOpMaker(OpProto* proto, OpAttrChecker* op_checker)
2323
: ElementwiseOpMaker(proto, op_checker) {
24-
SetComment("Add", "$Out = X + Y$");
24+
SetComment("Add", "Out = X + Y");
2525
AddComment(comment_);
2626
}
2727
};

paddle/operators/elementwise_div_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ElementwiseDivOpMaker : public ElementwiseOpMaker {
2121
public:
2222
ElementwiseDivOpMaker(OpProto* proto, OpAttrChecker* op_checker)
2323
: ElementwiseOpMaker(proto, op_checker) {
24-
SetComment("Div", "$Out = X / Y$");
24+
SetComment("Div", "Out = X / Y");
2525
AddComment(comment_);
2626
}
2727
};

paddle/operators/elementwise_mul_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ElementwiseMulOpMaker : public ElementwiseOpMaker {
2222
public:
2323
ElementwiseMulOpMaker(OpProto* proto, OpAttrChecker* op_checker)
2424
: ElementwiseOpMaker(proto, op_checker) {
25-
SetComment("Mul", "$Out = X \\odot\\ Y$");
25+
SetComment("Mul", "Out = X \\odot\\ Y");
2626
AddComment(comment_);
2727
}
2828
};

paddle/operators/elementwise_op.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ Limited Elementwise {name} Operator.
5858
5959
The equation is:
6060
61-
{equation}
61+
.. math::
62+
{equation}
6263
6364
X is a tensor of any dimension and the dimensions of tensor Y must be smaller than
6465
or equal to the dimensions of X.
@@ -71,15 +72,16 @@ For case 2:
7172
Y will be broadcasted to match the shape of X and axis should be
7273
the starting dimension index for broadcasting Y onto X.
7374
74-
example:
75-
shape(X) = (2, 3, 4, 5), shape(Y) = (,)
76-
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
77-
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
78-
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
79-
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
75+
For example
76+
.. code-block:: python
8077
81-
Both the input X and Y can carry the LoD (Level of Details) information,
82-
or not. But the output only shares the LoD information with input X.
78+
shape(X) = (2, 3, 4, 5), shape(Y) = (,)
79+
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
80+
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
81+
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
82+
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
83+
84+
Either of the inputs X and Y or none can carry the LoD (Level of Details) information. However, the output only shares the LoD information with input X.
8385
8486
)DOC";
8587
AddComment(comment_);

paddle/operators/elementwise_sub_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ElementwiseSubOpMaker : public ElementwiseOpMaker {
2121
public:
2222
ElementwiseSubOpMaker(OpProto* proto, OpAttrChecker* op_checker)
2323
: ElementwiseOpMaker(proto, op_checker) {
24-
SetComment("Sub", "$Out = X - Y$");
24+
SetComment("Sub", "Out = X - Y");
2525
AddComment(comment_);
2626
}
2727
};

0 commit comments

Comments
 (0)