-
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
[Typing][B-33,B-37] Add type annotations for python/paddle/amp/{amp_lists,__init__}.py
#65633
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,9 @@ | |||||
|
||||||
# The set of ops that support fp16 and bf16 calculation and are considered numerically- | ||||||
# safe and performance-critical. These ops are always converted to fp16 or bf16. | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PEP 563 |
||||||
from typing import Any | ||||||
|
||||||
WHITE_LIST = { | ||||||
'conv2d', | ||||||
'einsum', | ||||||
|
@@ -102,7 +105,7 @@ | |||||
|
||||||
|
||||||
# At OD level, ops in WHITE_LIST will use FP16/BF16 and the others will use FP32. | ||||||
def white_list(): | ||||||
def white_list() -> dict[str, dict[str, set[str]]]: | ||||||
white_list = { | ||||||
"float16": { | ||||||
"OD": FP16_WHITE_LIST, | ||||||
|
@@ -118,7 +121,7 @@ def white_list(): | |||||
return white_list | ||||||
|
||||||
|
||||||
def black_list(): | ||||||
def black_list() -> dict[str, dict[str, Any]]: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
应该也还是 另外,@SigureMo 这里有必要用 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不用了吧,这又不是公开 API,这里的输入输出的「协议」让开发的人自己把握就好了,改成 TypedDict 他们反而维护不起来了 |
||||||
black_list = { | ||||||
"float16": { | ||||||
"OD": set(), | ||||||
|
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,这个文件的统计是统计错了还是漏标记公开 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.
这俩是我这边手动添加的 ~
我这里统计的依据基本是遵循
__all__
的范围,有一些虽然没在里面,但是在__init__.py
里面导进去了,我看挺简单的也就放进去了 ~