Skip to content

Commit 7694199

Browse files
committed
refine docs of elementwise_op etc.
1 parent b3fd9da commit 7694199

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

paddle/fluid/operators/elementwise_op.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,24 @@ 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$ is a tensor of any dimension. And $Y$ is a tensor whose dimensions must be
76+
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) = (,)
@@ -98,8 +99,8 @@ For example
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
@@ -1409,7 +1409,7 @@ def sequence_pool(input, pool_type):
14091409

14101410
def sequence_first_step(input):
14111411
"""
1412-
This funciton get the first step of sequence.
1412+
This function get the first step of sequence.
14131413
14141414
.. code-block:: text
14151415
@@ -1442,7 +1442,7 @@ def sequence_first_step(input):
14421442

14431443
def sequence_last_step(input):
14441444
"""
1445-
This funciton get the last step of sequence.
1445+
This function get the last step of sequence.
14461446
14471447
.. code-block:: text
14481448

0 commit comments

Comments
 (0)