-
Notifications
You must be signed in to change notification settings - Fork 836
[API compatibility] Update 9 API Docs #7394
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
base: develop
Are you sure you want to change the base?
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7394.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
文档就麻烦 @sunzhongkai588 把关下吧 |
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.
- 新增的 API 都需要在对应 Overview.rst 下加入描述
- 文档写作参考 https://www.paddlepaddle.org.cn/documentation/docs/zh/dev_guides/api_contributing_guides/api_docs_guidelines_cn.html ,因为是 sphinx 语法所以对空格、缩进和空行敏感,需要注意
.. 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) |
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.
代码示例用 copy-from 的形式引用英文的代码示例,保持统一
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.
已修改
.. code-block:: python | ||
import paddle | ||
weight = paddle.nn.parameter.Parameter( | ||
data=paddle.randn([10, 10]), | ||
requires_grad=True | ||
) |
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.
代码部分用 copy-from 引用
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.
已修改
Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
3bde627
to
2dd8c78
Compare
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.
LGTM
Uh oh!
There was an error while loading. Please reload this page.