-
Notifications
You must be signed in to change notification settings - Fork 904
[API Compatibility] Update and add cn docs for aligned 19 apis -part #7893
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
Open
Manfredss
wants to merge
3
commits into
PaddlePaddle:develop
Choose a base branch
from
Manfredss:Api_Compat
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| .vscode | ||
| .comate | ||
| .idea | ||
| .claude | ||
|
|
||
| # virtualenv | ||
| venv/ | ||
|
|
||
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
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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| .. _cn_api_paddle__assert: | ||
|
|
||
| _assert | ||
| ------------------------------- | ||
|
|
||
| .. py:function:: paddle._assert(condition, message="") | ||
|
|
||
| 对 Python assert 的封装,支持符号追踪。 | ||
|
|
||
| 在动态图模式下,该函数的行为与 Python 的 assert 语句一致。在静态图模式下,当 condition 是 Tensor 时,会在计算图中创建一个 Assert 算子。 | ||
|
|
||
| 参数 | ||
| :::::::::::: | ||
| - **condition** (bool|Tensor) - 断言的条件。如果是 Tensor,必须是布尔标量(numel=1)。 | ||
| - **message** (str,可选) - 断言失败时显示的错误信息。默认值为 ""。 | ||
|
|
||
| 代码示例 | ||
| :::::::::::: | ||
|
|
||
| .. code-block:: pycon | ||
|
|
||
| >>> import paddle | ||
| >>> # Non-tensor condition | ||
| >>> paddle._assert(1 == 1, "This should pass") | ||
|
|
||
| >>> # Tensor condition | ||
| >>> x = paddle.to_tensor([True]) | ||
| >>> paddle._assert(x, "Tensor assertion") |
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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| .. _cn_api_paddle_inverse: | ||
|
|
||
| inverse | ||
| ------------------------------- | ||
|
|
||
| .. py:function:: paddle.inverse(x, name=None, *, out=None) | ||
|
|
||
| 计算方阵的逆矩阵。方阵是行数和列数相同的矩阵。输入可以是一个方阵(2-D Tensor)或者多个方阵组成的 batch(batch of square matrices)。 | ||
|
|
||
| 参数 | ||
| :::::::::::: | ||
| - **x** (Tensor) - 输入 Tensor,最后两个维度应相等。当维度大于 2 时,视为方阵的 batch。数据类型为 float32、float64、complex64、complex128。别名 ``input``。 | ||
| - **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。 | ||
|
|
||
| 关键字参数 | ||
| :::::::::::: | ||
| - **out** (Tensor,可选) - 输出 Tensor,若不为 ``None``,计算结果将保存在该 Tensor 中,默认值为 ``None``。 | ||
|
|
||
| 返回 | ||
| :::::::::::: | ||
| Tensor,``x`` 的逆矩阵,维度和数据类型与 ``x`` 相同。 | ||
|
|
||
| 代码示例 | ||
| :::::::::::: | ||
|
|
||
| .. code-block:: pycon | ||
|
|
||
| >>> import paddle | ||
|
|
||
| >>> mat = paddle.to_tensor([[2, 0], [0, 2]], dtype='float32') | ||
| >>> inv = paddle.inverse(mat) | ||
| >>> print(inv) | ||
| Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True, | ||
| [[0.50000000, 0. ], | ||
| [0. , 0.50000000]]) |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
这里用
interpolate(input, ...)与interpolate(x, ...)区分两种“调用方式”,但同一段文档中x也被标注为别名input,容易让读者误解为存在两个不同参数名/两个不同接口。建议在该段补一句说明:input为x的别名(PyTorch 风格命名),两种调用方式仅是参数组合差异。