[API compatibility] Update 9 API Docs#7394
Merged
sunzhongkai588 merged 5 commits intoPaddlePaddle:developfrom Sep 1, 2025
Merged
[API compatibility] Update 9 API Docs#7394sunzhongkai588 merged 5 commits intoPaddlePaddle:developfrom
sunzhongkai588 merged 5 commits intoPaddlePaddle:developfrom
Conversation
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7394.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
Member
|
文档就麻烦 @sunzhongkai588 把关下吧 |
Collaborator
sunzhongkai588
left a comment
There was a problem hiding this comment.
- 新增的 API 都需要在对应 Overview.rst 下加入描述
- 文档写作参考 https://www.paddlepaddle.org.cn/documentation/docs/zh/dev_guides/api_contributing_guides/api_docs_guidelines_cn.html ,因为是 sphinx 语法所以对空格、缩进和空行敏感,需要注意
Comment on lines
+23
to
+36
| .. code-block:: python | ||
| import paddle | ||
| # Case 1: 3D input (batched) | ||
| x = paddle.randn([2, 3, 10]) # [N, C, L] | ||
| y_train = paddle.nn.functional.dropout1d(x, p=0.2) | ||
| y_test = paddle.nn.functional.dropout1d(x, p=0.2, training=False) | ||
| print("Original first channel:", x[0, 0, :]) | ||
| print("Train output (may be zeroed):", y_train[0, 0, :]) | ||
| print("Test output (always unchanged):", y_test[0, 0, :]) | ||
| # Case 2: 2D input (single sample) | ||
| x = paddle.randn([3, 8]) # [C, L] | ||
| y = paddle.nn.functional.dropout1d(x, p=0.5) | ||
| print("Input shape:", x.shape) | ||
| print("Output shape:", y.shape) |
Collaborator
There was a problem hiding this comment.
代码示例用 copy-from 的形式引用英文的代码示例,保持统一
Comment on lines
+19
to
+24
| .. code-block:: python | ||
| import paddle | ||
| weight = paddle.nn.parameter.Parameter( | ||
| data=paddle.randn([10, 10]), | ||
| requires_grad=True | ||
| ) |
Collaborator
There was a problem hiding this comment.
代码部分用 copy-from 引用
Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
3bde627 to
2dd8c78
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Uh oh!
There was an error while loading. Please reload this page.