Skip to content

Commit ca4d528

Browse files
authored
Merge pull request #11369 from luotao1/refine_doc
refine docs of elementwise_op etc.
2 parents 5100c4c + c4c7873 commit ca4d528

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

paddle/fluid/operators/elementwise_op.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,40 +66,41 @@ class ElementwiseOpMaker : public framework::OpProtoAndCheckerMaker {
6666
.SetDefault(-1)
6767
.EqualGreaterThan(-1);
6868
AddComment(string::Sprintf(R"DOC(
69-
Limited Elementwise %s Operator.
69+
Limited Elementwise %s Operator
7070
7171
The equation is:
7272
7373
$$%s$$
7474
75-
$X$ is a tensor of any dimension and the dimensions of tensor $Y$ must be
76-
smaller than or equal to the dimensions of $X$.
75+
- $X$: a tensor of any dimension.
76+
- $Y$: a tensor whose dimensions must be less than or equal to the dimensions of $X$.
7777
7878
There are two cases for this operator:
79-
1. The shape of $Y$ is same with $X$;
80-
2. The shape of $Y$ is a congiguous subsequencet of $X$. The trailing dimensions
81-
of size 1 for $Y$ will be ignored for the consideration of subsequence.
8279
80+
1. The shape of $Y$ is the same with $X$.
81+
2. The shape of $Y$ is a continuous subsequence of $X$.
8382
8483
For case 2:
8584
86-
$Y$ will be broadcasted to match the shape of $X$ and axis should be
87-
set to index of the start dimension to broadcast $Y$ onto $X$.
85+
1. Broadcast $Y$ to match the shape of $X$, where $axis$ is the start dimension index
86+
for broadcasting $Y$ onto $X$.
87+
2. If $axis$ is -1 (default), $axis = rank(X) - rank(Y)$.
88+
3. The trailing dimensions of size 1 for $Y$ will be ignored for the consideration of
89+
subsequence, such as shape(Y) = (2, 1) => (2).
8890
89-
If axis is -1, it is treated as axis=rank(X)-rank(Y).
91+
For example:
9092
91-
For example
9293
.. code-block:: python
9394
9495
shape(X) = (2, 3, 4, 5), shape(Y) = (,)
9596
shape(X) = (2, 3, 4, 5), shape(Y) = (5,)
96-
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5)
97+
shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5), with axis=-1(default) or axis=2
9798
shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1
9899
shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0
99100
shape(X) = (2, 3, 4, 5), shape(Y) = (2, 1), with axis=0
100101
101-
Either of the inputs $X$ and $Y$ or none can carry the LoD (Level of Details)
102-
information. However, the output only shares the LoD information with input $X$.
102+
The inputs $X$ and $Y$ can carry the different LoD information.
103+
But the output only shares the LoD information with the input $X$.
103104
104105
)DOC",
105106
GetName(), GetEquation()));

python/paddle/fluid/layers/nn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ def sequence_pool(input, pool_type):
14451445

14461446
def sequence_first_step(input):
14471447
"""
1448-
This funciton get the first step of sequence.
1448+
This function gets the first step of sequence.
14491449
14501450
.. code-block:: text
14511451
@@ -1478,7 +1478,7 @@ def sequence_first_step(input):
14781478

14791479
def sequence_last_step(input):
14801480
"""
1481-
This funciton get the last step of sequence.
1481+
This function gets the last step of sequence.
14821482
14831483
.. code-block:: text
14841484

0 commit comments

Comments
 (0)