-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add api doc std #8927
Add api doc std #8927
Conversation
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注释是使用rst格式来写,参考链接:http://sphinx-doc-zh.readthedocs.io/en/latest/rest.html
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
API文档各模块格式及示例如下: | ||
|
||
### Python API Definition & Python Wrapper Location |
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.
- 49行是12行+16行,如果前面分开列了,这儿也要分开列。两者需要统一。
- 前面使用
-
,这儿使用###
,需要统一使用-
。51行和57行的-
进行缩进。改成rst文件后,这儿的格式也需要略作调整。
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
- 示例 | ||
|
||
#### [fluid.layers.fc](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/layers/nn.py) |
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.
- 这里的链接是到nn.py,并不是直接到fc
- 示例的链接:请使用以下方法,将md文件改成rst文件,然后将完整的注释拿出来专门做一个.py文件,放在同目录下的src子目录下。引用方式参考:
https://github.com/PaddlePaddle/Paddle/blob/develop/doc/v2/howto/rnn/hrnn_rnn_api_compare_cn.rst
.. literalinclude:: ../../../../paddle/gserver/tests/sequenceGen.py
:language: python
:lines: 42-71
:linenos:
来一一说明每行对应哪个格式。
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的丰富,对应的行可能会发生变化
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.
对于一个专门的示例py文件来说,它是不会随着api的丰富而发生变化的。
doc/fluid/dev/api_doc_std_cn.md
Outdated
name=None, | ||
main_program=None, | ||
startup_program=None) | ||
``` |
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.
61-69行是说明什么呢?可以在47行加上:以fc为例来进行说明?
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.
[Python API Definition]
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
- 格式: | ||
|
||
[Python API Name][Python Wrapper URL] |
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.
Python Wrapper URL的示例是在哪儿?需要对每个[]内容都有示例。
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.
Line59
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.
Python Wrapper URL的示例 能否做成自动生成,如果做不到的话,就不要列了。后期维护会很麻烦。
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
[Formula] | ||
|
||
[Symbols' Descriptions if necessary] |
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.
需要对每个[]的示例进行说明,我理解85行是Function Description,86行是Formula,87行是Symbols' Descriptions,需要再强调说一下
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
- 示例 | ||
|
||
以dynamic_lstm为例 |
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.
全文的示例能否统一,上文是fc,这儿是dynamic_lstm,能否统一?
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.
原本是想演示下 当返回值为多个的情况怎么写
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示例即可。
doc/fluid/dev/api_doc_std_cn.md
Outdated
- 示例 | ||
|
||
``` | ||
``` |
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.
请加示例
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
```python | ||
data = fluid.layers.data(name='data', shape=[1], dtype='float32') | ||
fc = fluid.layers.fc(input=data, size=10, act="tanh") |
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.
fc的注释不只你列出来的,可以使用rst文档的literalinclude来完整引入(上面评论中有写)。
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.
没太明白这句话,这里fc的注释还缺什么?
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.
http://www.paddlepaddle.org/docs/develop/api/en/fluid/layers.html#fc 看注释内容非常多,你列出来的每一项都不全。
doc/fluid/dev/api_doc_std_cn.md
Outdated
@@ -0,0 +1,203 @@ | |||
# API文档撰写 |
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注释撰写标准
doc/fluid/dev/api_doc_std_cn.md
Outdated
@@ -0,0 +1,203 @@ | |||
# API文档撰写 | |||
|
|||
- [API文档模块](#API文档模块) |
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注释模块
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.
请对应更新src/fc.py的注释和nn.py里面fc的注释。
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
## 完整示例 | ||
|
||
fc 的完整注释见[示例](https://github.com/PaddlePaddle/Paddle/tree/develop/doc/fluid/dev/src/fc.py)。 |
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.
链接使用相对路径,现在的路径访问不了。
[示例](src/fc.py)
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
- 示例 | ||
|
||
fc没有注意事项,故该模块省略不写。其他情况应明确给出,若有多条注意事项,须分条列出,以scaled\_dot\_product\_attention为例: |
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.
其他情况指哪些情况?改成:如有注意事情应明确给出?
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
``` | ||
Args: | ||
input (Tensor): The input tensor(s) of the layer. |
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.
input这个注释需要修改
- 原来也有list类型给漏掉了。
(Variable|list) – The input tensor(s) to the fully connected layer.
- 这个tensor是几维的。
- input和output都是Variable,variable里面是XX维的tensor
doc/fluid/dev/api_doc_std_cn.md
Outdated
|
||
## 格式及示例 | ||
|
||
API文档各模块格式及示例如下(以下以fc为例进行说明): |
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.
43行的括号需要改完中文括号。
- [完整示例](#完整示例) | ||
|
||
|
||
## API注释模块 |
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注释文档是使用rst格式来写,有关rst格式的参考链接:http://sphinx-doc-zh.readthedocs.io/en/latest/rest.html
请组织语言。
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.
Done
doc/fluid/dev/api_doc_std_cn.md
Outdated
@@ -40,7 +40,7 @@ API文档须包含以下几个模块(排列顺序为文档撰写顺序): | |||
|
|||
## 格式及示例 | |||
|
|||
API文档各模块格式及示例如下(以下以fc为例进行说明): | |||
API文档须使用rst格式撰写,该格式详情请参考[链接](http://sphinx-doc-zh.readthedocs.io/en/latest/rest.html)。API文档各模块的内容格式及示例如下(以下以fc为例进行说明): |
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.
rst->reStructuredText
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.
Done
doc/fluid/dev/api_doc_std_cn.md
Outdated
@@ -137,7 +137,7 @@ API文档各模块格式及示例如下(以下以fc为例进行说明): | |||
|
|||
``` | |||
Args: | |||
input (Tensor): The input tensor(s) of the layer. | |||
input (Variable|list of Variable): This layer's input tensor(s) which is at least 2-dimensional. |
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.
The input tensor(s) of the layer, and the dimension of the input tensor(s) is at least 2.
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.
Done
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! Thanks very much!
fix #8866
fix #8834