Skip to content
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

Update python api and c++ op develop guide #5189

Merged
merged 6 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ API 设计文档的目的是为了社区开发者更容易的参与开源项目
:hidden:

read_before_contributing_cn.md
api_design_guidelines_standard_cn.md
new_python_api_cn.md
new_cpp_op_cn.md
api_design_guidelines_standard_cn.md
api_docs_guidelines_cn.md
api_accpetance_criteria_cn.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 飞桨 API 的设计和命名规范
# API 设计和命名规范

## API 设计规范

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 飞桨 API 文档书写规范
# API 文档书写规范

1. **至关重要:** **API 文档对该 API 的描述,一定要与 API 的行为保持一致。中英文文档的内容要严格一致。**
2. **API 文档的字段:** API 名称、API 功能描述、API 参数、API 返回、API 代码示例、API 属性(class)、API 方法(methods)等。是否写 API 抛出异常的情况,不做强制要求。
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
707 changes: 360 additions & 347 deletions docs/dev_guides/api_contributing_guides/new_cpp_op_cn.md

Large diffs are not rendered by default.

430 changes: 254 additions & 176 deletions docs/dev_guides/api_contributing_guides/new_python_api_cn.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

<center><img src="https://github.com/PaddlePaddle/docs/blob/develop/docs/dev_guides/api_contributing_guides/images/paddle_api.png?raw=true" width="800" ></center>

## 二、飞桨 API 设计文档提交说明
## <span id="apiDesignDoc">二、飞桨 API 设计文档提交说明</span>

设计文档,通常也叫 RFC(Request for Comment)文档,可方便开发者与飞桨核心团队、其他社区开发者充分交流设计思路,以便进一步完善设计方案,并确保与飞桨设计理念一致。请参考如下步骤完成 API 设计文档的提交:

1. 阅读 [飞桨 API 设计和命名规范](api_design_guidelines_standard_cn.html),确保新增 API 符合飞桨相关规范。
1. 阅读 [API 设计和命名规范](api_design_guidelines_standard_cn.html),确保新增 API 符合飞桨相关规范。
2. 根据 [API 设计文档模版](https://github.com/PaddlePaddle/community/blob/master/rfcs/APIs/api_design_template.md),填写必要的设计内容。另外可参考 [API 设计文档样例](https://github.com/PaddlePaddle/community/blob/master/rfcs/APIs/20200301_api_design_for_quantile.md)。
3. 将设计文档提交 Pull Request (PR)到 [community/rfcs/APIs/ ](https://github.com/PaddlePaddle/community/tree/master/rfcs/APIs) 目录下。
4. 等待文档接受评审和讨论,并根据各方意见修改文档。通常飞桨团队会在三个工作日内回复,如果 API 功能较复杂,还将发起评审会议,并提前在 PR 的评论区公布会议时间、会议地址、参与人、议题等内容,请及时关注 PR 中最新动态。
Expand All @@ -28,8 +28,8 @@

当 API 设计文档合入后,开发者即可进行代码开发。此过程请参考相应的开发规范,包括如下步骤:

- 如果新增 API 不需要开发新的 C++ OP,可以用其他 Python API 组合得到新的 API,请参考 [飞桨 API Python 端开发指南](new_python_api_cn.html) 章节完成,包括开发 Python 代码、单元测试代码和 API 文档等步骤。
- 如果新增 API 需要开发新的 C++ OP,请参考 [C++ 算子开发指南](new_cpp_op_cn.html) 章节完成,包括开发 OP 实现代码、封装 Python API 代码、单元测试代码和 API 文档等步骤。
- 如果新增 API 不需要开发新的 C++ OP,可以用其他 Python API 组合得到新的 API,请参考 [开发 API Python ](new_python_api_cn.html) 章节完成,包括开发 Python 代码、单元测试代码和 API 文档等步骤。
- 如果新增 API 需要开发新的 C++ OP,请参考 [开发 C++ 算子](new_cpp_op_cn.html) 章节完成,包括开发 OP 实现代码、封装 Python API 代码、单元测试代码和 API 文档等步骤。
- 在 paddle/phi/kernels 目录下存放了飞桨框架已经实现的不同硬件的算子内核,可供开发 C++ OP 时调用。
- 有时也需要自己开发新的算子内核(OP Kernel),这时可能需要使用硬件支持的软件栈(如 CUDA)来实现,或者使用飞桨框架提供的 Kernel Primitive API 来实现,后者具体介绍请参见 [Kernel Primitive API](../op_optimization/kernel_primitive_api/index_cn.html) 章节。

Expand All @@ -42,7 +42,7 @@

请遵循如下开发规范和测试要求:

- [代码风格规范](../style_guide_and_references/style_guides_cn.html)
- [飞桨 API 设计和命名规范](api_design_guidelines_standard_cn.html)
- [飞桨 API 单元测试及验收规范](api_accpetance_criteria_cn.html)
- [Paddle CI 测试详解](../style_guide_and_references/paddle_ci_manual_cn.html)
- [代码风格规范](../git_guides/codestyle_check_guide_cn.html)
- [API 设计和命名规范](api_design_guidelines_standard_cn.html)
- [API 单元测试及验收规范](api_accpetance_criteria_cn.html)
- [Paddle CI 测试详解](../git_guides/paddle_ci_manual_cn.html)
6 changes: 3 additions & 3 deletions docs/dev_guides/code_contributing_path_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

请提前阅读贡献流程、代码规范、单元测试规范等信息,以确保您提交的代码符合飞桨的相关准则,尽可能高效地合入代码。

通常你需要提前阅读本章节,以及通用的 [规范和参考信息](style_guide_and_references/index_cn.html),然后根据贡献内容阅读对应模块的指南,比如需要贡献一个新的 API,则需阅读 [新增 API 贡献指南](api_contributing_guides/api_contributing_guides_cn.html),后续飞桨也将提供其他的如功能增强、性能优化等相关贡献指南,当然也欢迎开发者贡献这些指南。
通常你需要提前阅读本章节,以及通用的 [规范和参考信息](style_guide_and_references/index_cn.html),然后根据贡献内容阅读对应模块的指南,比如需要贡献一个新的 API,则需阅读 [新增 API 开发&提交流程](api_contributing_guides/api_contributing_guides_cn.html),后续飞桨也将提供其他的如功能增强、性能优化等相关贡献指南,当然也欢迎开发者贡献这些指南。

> 说明:文档的贡献流程与代码有所不同,直接阅读 [文档贡献指南](docs_contributing_guides_cn.html) 即可。

Expand Down Expand Up @@ -75,7 +75,7 @@ Paddle 使用的 pre-commit 是 2.17.0 版本,首先安装并在本地仓库

(2)开发代码

可根据贡献内容,参考对应模块的贡献指南开发代码,如 [新增 API 贡献指南](api_contributing_guides/api_contributing_guides_cn.html),包括:
可根据贡献内容,参考对应模块的贡献指南开发代码,如 [新增 API 开发&提交流程](api_contributing_guides/api_contributing_guides_cn.html),包括:

- 功能实现代码
- 单元测试代码
Expand Down Expand Up @@ -233,7 +233,7 @@ upstream https://github.com/PaddlePaddle/Paddle.git (push)

<span id="CItest">(6)确保通过 CI 测试</span>

提交 Pull Request 后会触发 CI(Continuous Integration,持续集成)测试,并且之后每提交一次代码合入(`git push`)都会触发一次 CI 测试。CI 测试可尽可能保障代码质量,详细测试内容可参见 [Paddle CI 测试详解](style_guide_and_references/paddle_ci_manual_cn.html)。
提交 Pull Request 后会触发 CI(Continuous Integration,持续集成)测试,并且之后每提交一次代码合入(`git push`)都会触发一次 CI 测试。CI 测试可尽可能保障代码质量,详细测试内容可参见 [Paddle CI 测试详解](../git_guides/paddle_ci_manual_cn.html)。

提交 Pull Request 后,请关注 CI 测试进程,一般会在几个小时内完成。

Expand Down