[Docs] Fix code example errors in API docs (paddle.device, paddle.diagonal)#7791
Merged
ooooo-create merged 2 commits intoPaddlePaddle:developfrom Feb 28, 2026
Conversation
- Fix capitalization error: Paddle.CustomPlace -> paddle.CustomPlace in
device/max_memory_reserved_cn.rst, device/memory_allocated_cn.rst,
device/memory_reserved_cn.rst
- Add missing space after comma in paddle.CustomPlace('npu', 0)
- Fix typo: 既主对角线 -> 即主对角线 in diagonal_cn.rst
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 针对 docs/api/paddle/ 下的中文 API 参考文档进行勘误,修复会导致示例代码不可用/易误导的模块名大小写问题,并更正一处中文用字错误,以提升 API 文档的可用性与准确性。
Changes:
- 将示例中的
Paddle.CustomPlace更正为实际模块名paddle.CustomPlace,并补齐参数逗号后的空格('npu',0→'npu', 0)。 - 将
diagonal文档参数说明中的“既主对角线”更正为“即主对角线”。
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/api/paddle/diagonal_cn.rst | 修正文案用字错误(既→即),避免语义误解 |
| docs/api/paddle/device/memory_reserved_cn.rst | 修正 CustomPlace 调用示例的模块名大小写与格式 |
| docs/api/paddle/device/memory_allocated_cn.rst | 修正 CustomPlace 调用示例的模块名大小写与格式 |
| docs/api/paddle/device/max_memory_reserved_cn.rst | 修正 CustomPlace 调用示例的模块名大小写与格式 |
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7791.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
Echo-Nie
approved these changes
Feb 28, 2026
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.
Summary
This PR fixes documentation errors found in API reference docs under
docs/api/paddle/.Changes
1. Fix capitalization error:
Paddle.CustomPlace→paddle.CustomPlaceThe following files contained incorrect capitalization in their code examples —
Paddle(capitalized) should bepaddle(lowercase), aspaddleis the actual Python module name:docs/api/paddle/device/max_memory_reserved_cn.rstdocs/api/paddle/device/memory_allocated_cn.rstdocs/api/paddle/device/memory_reserved_cn.rstAlso fixes missing space after comma:
'npu',0→'npu', 0.Before:
After: