-
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-92] Add type annotations for python/paddle/batch.py
#66295
[Typing][B-92] Add type annotations for python/paddle/batch.py
#66295
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
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.
这已经是第三次提示了,按照 PR-CI-Codestyle-Check
报错提示运行 pre-commit
python/paddle/batch.py
Outdated
|
||
if TYPE_CHECKING: | ||
from types import ModuleType |
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.
这是没有用的,在新的提交中已经将其删除。
python/paddle/batch.py
喔,抱歉看错人了,这是第一次 😂 |
python/paddle/batch.py
Outdated
reader: Generator[T, None, None], batch_size: int, drop_last: bool = False | ||
) -> Generator[List[T], None, 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.
reader: Generator[T, None, None], batch_size: int, drop_last: bool = False | |
) -> Generator[List[T], None, None]: | |
reader: Callable[[], Generator[_T, None, None]], batch_size: int, drop_last: bool = False | |
) -> Callable[[], Generator[list[_T], None, 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.
Done
Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
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.
- pre-commit 仍然没跑
- 输入输出类型不对,没有按照 @megemini 的提示修改,可以参考 [Typing][B-93] Add type annotations for
python/paddle/reader/decorator.py
#66305 定义一个TypeAlias
python/paddle/batch.py
Outdated
|
||
def batch(reader, batch_size, drop_last=False): | ||
def batch( | ||
reader: Generator[T, None, None], batch_size: int, drop_last: bool = False |
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.
上面定义了 _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.
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.
…dlePaddle#66295) --------- Co-authored-by: Nyakku Shigure <sigure.qaq@gmail.com>
PR Category
User Experience
PR Types
Improvements
Description
类型标注:
Related links
@SigureMo @megemini