-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Typing] Paddle 的 CI 中引入 mypy 对于 API 中 docstring 的示例代码的类型检查 #63901
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
Changes from 37 commits
b8c2201
5dab33d
c11b093
436175f
f6927c2
c4ba2bf
9fba61a
36ba294
68354cb
7c2a715
9654c26
732aff8
458802a
363ec84
41aa797
c8775e3
0dae862
5c996a0
ce613b2
fb6cef6
edc4b23
9857d86
a7ed18c
51fda55
98dc1df
eb1f468
c75c574
495d0b7
40b66c7
0181f23
e7be07d
618c3b9
72067ed
37ae0ab
cf37661
5cc0c4b
f9c381e
06dee11
ae07a13
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 |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| math functions | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import math | ||
| import warnings | ||
|
|
||
|
|
@@ -212,7 +214,10 @@ def log_(x, name=None): | |
| return _C_ops.log_(x) | ||
|
|
||
|
|
||
| def scale(x, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None): | ||
| # TODO(megemini): type checking | ||
| def scale( | ||
| x, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None | ||
| ) -> int: | ||
| """ | ||
| Scale operator. | ||
|
|
||
|
|
@@ -322,7 +327,7 @@ def scale(x, scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None): | |
| return helper.append_activation(out) | ||
|
|
||
|
|
||
| def stanh(x, scale_a=0.67, scale_b=1.7159, name=None): | ||
|
Member
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.
Member
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. 类型检查跳过了,符合预期~ 这里可以恢复下了~
Member
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.
Member
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. 已经确认,可以在下个 PR 这么搞下
Member
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. |
||
| def stanh(x, scale_a: int = 1, scale_b=1.7159, name=None): | ||
| r""" | ||
|
|
||
| stanh activation. | ||
|
|
||


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.
关于这块的
mypy_cache有个小问题,如果我根据 shell 脚本来跑,这个路径将会是在tools/.mypy_cache, 而不是${PADDLE_ROOT}/.mypy_cache。是故意这么设计的嘛emmmThere 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.
这个有什么影响吗?
pyproject.toml可以配置另外,刚好有个问题请教一下!
我这里
paddle_build.sh中的run_type_checking参考的check_run_sot_ci:但是,
$(git log -1 --pretty=format:"%s" | grep -w "test=type_checking" || true)没有效果,所以去掉了,只使用了 title 的判断条件 ~我本地
$(git log -1 --pretty=format:"%s" | grep -w "test=type_checking" || true)没问题 ~这是咋回事儿?有啥办法?
Uh oh!
There was an error while loading. Please reload this page.
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.
影响就是,这样就会生成和维护两份缓存了
可以把
git log -1改成git log -10或者更大,因为 ci 在运行之前会git pull upstream develop所以导致没有命中我们想要的 commit (sot那个我自己来修吧, 感谢大佬发现的问题)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.
😅 我草率了 ... ... 当时没想这么多 ... ...
那我在
type_checking.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.
@gouzil 已修改 ~