-
Notifications
You must be signed in to change notification settings - Fork 5.9k
add illustration for reshape API #63365
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
55ddd76
feat:add illustration for reshape API && fix:grammatical mistakes of …
WoWYoYLoL 834d640
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
WoWYoYLoL 153cee6
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
WoWYoYLoL 09516c3
bug fixes
WoWYoYLoL e18f3de
add illustration for reshape API
WoWYoYLoL dcdd4e3
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
WoWYoYLoL ba4de5f
Update python/paddle/tensor/manipulation.py
sunzhongkai588 2cf2c69
add illustration for reshape API
WoWYoYLoL 8f5af05
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
WoWYoYLoL dc3248e
add illustration for the reshape API
WoWYoYLoL 532460d
Update python/paddle/tensor/manipulation.py
sunzhongkai588 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4345,11 +4345,15 @@ def reshape(x, shape, name=None): | |
|
|
||
| - 3. Given a 3-D tensor x with a shape [2, 4, 6], and the target shape is [-1, 0, 3, 2], the reshape operator will transform x into a 4-D tensor with shape [2, 4, 3, 2] and leaving x's data unchanged. In this case, besides -1, 0 means the actual dimension value is going to be copied from the corresponding dimension of x. | ||
|
|
||
| The following figure illustrates the first example -- a 3D tensor of shape [2, 4, 6] is transformed into a 2D tensor of shape [6, 8], during which the order and values of the elements in the tensor remain unchanged. The elements in the two subdiagrams correspond to each other, clearly demonstrating how the reshape API works. | ||
|
|
||
|  | ||
|
|
||
| Args: | ||
| x (Tensor): An N-D Tensor. The data type is ``float16``, ``float32``, ``float64``, ``int16``, ``int32``, ``int64``, ``int8``, ``uint8``, ``complex64``, ``complex128``, ``bfloat16`` or ``bool``. | ||
| x (Tensor): A N-D Tensor. The data type is ``float16``, ``float32``, ``float64``, ``int16``, ``int32``, ``int64``, ``int8``, ``uint8``, ``complex64``, ``complex128``, ``bfloat16`` or ``bool``. | ||
|
||
| shape (list|tuple|Tensor): Define the target shape. At most one dimension of the target shape can be -1. | ||
| The data type is ``int32`` . If ``shape`` is a list or tuple, each element of it should be integer or Tensor with shape []. | ||
| If ``shape`` is an Tensor, it should be an 1-D Tensor . | ||
| If ``shape`` is a Tensor, it should be a 1-D Tensor . | ||
| name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`. | ||
|
|
||
| Returns: | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这边不要用 markdown 格式的图片引用,否则无法渲染,可以看预览。和中文( PaddlePaddle/docs#6569 )一致即可,但引用路径需要改一下,因为仓库换了(docs -> Paddle)。
因为英文文档是通过抽取源码里的docstring,生产.rst 文件,所以和中文一样,得符合 sphinx 语法。