-
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] Add type annotations for paddle.jit
#64867
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
_SeqLevel4[_T], | ||
_SeqLevel5[_T], | ||
_SeqLevel6[_T], | ||
] |
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.
这是很久以前不支持递归类型定义才这样写的,现在测试过递归类型定义(31 行),mypy 和 pyright 都可以正常识别
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
@@ -102,7 +111,7 @@ def convert_to_list(value, n, name, dtype=int): | |||
return value_list | |||
|
|||
|
|||
def is_sequence(seq): | |||
def is_sequence(seq: Any) -> TypeGuard[typing.Sequence[Any]]: |
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.
这里是不是 bool?
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.
可以了解下 TypeGuard
、TypeIs
PR Category
User Experience
PR Types
Improvements
Description
为
paddle.jit
模块添加类型提示,to_static
API 的各种使用场景在 https://github.com/cattidea/paddlepaddle-stubs/blob/main/paddle-stubs/jit/api.pyi 和 https://github.com/cattidea/paddlepaddle-stubs/blob/main/tests/test_jit.py 进行了实验和验证PCard-66972
@megemini