-
Notifications
You must be signed in to change notification settings - Fork 755
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
Dev add docstring #5449
Merged
Merged
Dev add docstring #5449
Conversation
This file contains 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
doombeaker
commented
Jul 11, 2021
@hjchen2 @BBuf 我周五试错了半天,发现之前和你们介绍的 PyTorch 给 functional 添加文档的思路,我们是没有必要学,也不好学的,原因有:
你们帮忙看下这个 PR 的思路可以的吗? |
BBuf
reviewed
Jul 11, 2021
hjchen2
reviewed
Jul 11, 2021
hjchen2
approved these changes
Jul 11, 2021
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.
在 Python 层,通过在初始化时,runtime 地给 functional 方法添加
__doc__
,达到添加文档的目的。使用方法:
参照
oneflow/python/framework/docstr/math_ops.py
和oneflow/python/framework/docstr/random.py
的例子。调用add_docstr
即可:其它:
sin
,cos
,bernoulli
),是为了展示可以把add_docstr
放在多个文件中(math_ops.py
和random.py
)oneflow/python/test/modules/test_functional_docstr.py
文件,会遍历flow.F
和flow.experimental.F
测试 docstr