Skip to content

Conversation

@megemini
Copy link
Contributor

PR Category

User Experience

PR Types

Bug fixes

Description

引入 _Place 以解决 PlaceCPUPlace 等无继承关系的问题。

关联 PR #65008 #65397

@SigureMo

@paddle-bot
Copy link

paddle-bot bot commented Jul 28, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Jul 28, 2024
@megemini megemini changed the title [Fix] typing place [Typing] 增加 _Place 修复继承类型关系 Jul 28, 2024
def __iter__(self) -> _DataLoaderIterBase:
def __iter__(
self,
) -> _DataLoaderIterSingleProcess | _DataLoaderIterMultiProcess:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是有什么用么?示例代码里用了什么基类上没有的方法吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_DataLoaderIterBase 木有 __next__ 方法,不能用 for-loop ,如

            >>> dataset = SplitedIterableDataset(start=2, end=9)
            >>> dataloader = DataLoader(
            ...     dataset,
            ...     num_workers=2,
            ...     batch_size=1,
            ...     drop_last=True)
            ...
            >>> for data in dataloader:
            ...     print(data) # doctest: +SKIP("The output depends on the environment.")

检查会出错,但是 _DataLoaderIterSingleProcess | _DataLoaderIterMultiProcess 都实现了 ~ 感觉是代码实现上遗漏了 ... ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉应该在基类上加一下,raise NotImplementedError 就可以了

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@SigureMo SigureMo merged commit 6a21709 into PaddlePaddle:develop Jul 28, 2024
lixcli pushed a commit to lixcli/Paddle that referenced this pull request Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants