Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix add_n doc (eng) #28464

Merged
merged 3 commits into from
Nov 12, 2020
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
66 changes: 35 additions & 31 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,37 +718,41 @@ def sum(x, axis=None, dtype=None, keepdim=False, name=None):
@templatedoc(op_type="sum")
def add_n(inputs, name=None):
"""
${comment}

Case 1:
::
Input:
Input. Shape = [2, 3]
Input = [[1, 2, 3],
[4, 5, 6]]

Output:
The output. Shape = [2, 3]
Output = [[1, 2, 3],
[4, 5, 6]]

Case 2:
::
Input:
First input:
Input1. Shape = [2, 3]
Input1 = [[1, 2, 3],
[4, 5, 6]]

The second input:
Input2. Shape = [2, 3]
Input2 = [[7, 8, 9],
[10, 11, 12]]

Output:
The output. Shape = [2, 3]
Output = [[8, 10, 12],
[14, 16, 18]]
This OP is used to sum one or more Tensor of the input.

For example:

.. code-block:: text

Case 1:

Input:
input.shape = [2, 3]
input = [[1, 2, 3],
[4, 5, 6]]

Output:
output.shape = [2, 3]
output = [[1, 2, 3],
[4, 5, 6]]

Case 2:

Input:
First input:
input1.shape = [2, 3]
Input1 = [[1, 2, 3],
[4, 5, 6]]

The second input:
input2.shape = [2, 3]
input2 = [[7, 8, 9],
[10, 11, 12]]

Output:
output.shape = [2, 3]
output = [[8, 10, 12],
[14, 16, 18]]

Args:
inputs (Tensor|list(Tensor)): A Tensor list. The shape and data type of the list elements should be consistent.
Expand Down