Skip to content

[Docs] Fix code example errors in API docs (paddle.device, paddle.diagonal)#7791

Merged
ooooo-create merged 2 commits intoPaddlePaddle:developfrom
StatefulDust:fix/api-docs-issues-20260228075214-b610caf41c68c64a
Feb 28, 2026
Merged

[Docs] Fix code example errors in API docs (paddle.device, paddle.diagonal)#7791
ooooo-create merged 2 commits intoPaddlePaddle:developfrom
StatefulDust:fix/api-docs-issues-20260228075214-b610caf41c68c64a

Conversation

@ooooo-create
Copy link
Collaborator

Summary

This PR fixes documentation errors found in API reference docs under docs/api/paddle/.

Changes

1. Fix capitalization error: Paddle.CustomPlacepaddle.CustomPlace

The following files contained incorrect capitalization in their code examples — Paddle (capitalized) should be paddle (lowercase), as paddle is the actual Python module name:

  • docs/api/paddle/device/max_memory_reserved_cn.rst
  • docs/api/paddle/device/memory_allocated_cn.rst
  • docs/api/paddle/device/memory_reserved_cn.rst

Also fixes missing space after comma: 'npu',0'npu', 0.

Before:

>>> paddle.device.max_memory_reserved(Paddle.CustomPlace('npu',0))

After:

>>> paddle.device.max_memory_reserved(paddle.CustomPlace('npu', 0))
```

### 2. Fix typo: `既主对角线` → `即主对角线`

- `docs/api/paddle/diagonal_cn.rst`

The character `既` (meaning "already/since") was incorrectly used where `即` (meaning "namely/i.e.") was intended.

**Before:**
```
默认值为 0,既主对角线```

**After:**
```
默认值为 0,即主对角线

Generated by API Docs Checker


🔄 Synced from StatefulDust#7

- 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>
@github-actions
Copy link

github-actions bot commented Feb 28, 2026

📚 本次 PR 文档预览链接(点击展开)
ℹ️ 预览提醒
请等待 Docs-NEW 流水线运行完成后再点击预览链接,否则可能会看到旧版本内容或遇到链接无法访问的情况。
  • docs/api/paddle/device/max_memory_reserved_cn.rst: 点击预览
  • docs/api/paddle/device/memory_allocated_cn.rst: 点击预览
  • docs/api/paddle/device/memory_reserved_cn.rst: 点击预览

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 调用示例的模块名大小写与格式

@paddle-bot
Copy link

paddle-bot bot commented Feb 28, 2026

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7791.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@ooooo-create ooooo-create merged commit 3566cbf into PaddlePaddle:develop Feb 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants