Skip to content
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

【Hackathon 5th No.24】Add SubsetRandomSampler #648

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

Asthestarsfalll
Copy link
Contributor

@Asthestarsfalll Asthestarsfalll commented Sep 25, 2023

add rfc of SubsetRandomSampler

和代码同步修改

@paddle-bot
Copy link

paddle-bot bot commented Sep 25, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

@luotao1 luotao1 changed the title add rfc of SubsetRandomSampler 【Hackathon 5th No.24】Add SubsetRandomSampler Sep 26, 2023
@Asthestarsfalll
Copy link
Contributor Author

@lxd-cumt 劳烦看一下

## API实现方案

pytorch的sampler整体设计与paddle类似,因此考虑参考pytorch的方案实现
在 python\paddle\io\sampler.py 中添加对应类。但是由于paddle并没有完全支持`generator`,因此将该参数移除。

Choose a reason for hiding this comment

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

subsetrandomsampler中__iter__方法会通过randperm函数将indices打散,并支持设置随机数生成器generator,请确认一下paddle中提供的randperm函数的用法,并且对比一下配置generator和未配置generator的区别

Copy link
Contributor Author

Choose a reason for hiding this comment

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

paddle 中 randperm 参数如下:

paddle.randperm(n, dtype='int64', name=None)

并不支持 generator。不仅是 randperm,randn、randint 等也不支持。

相关issue:

@luotao1 luotao1 merged commit 0dba810 into PaddlePaddle:master Oct 18, 2023
yangguohao pushed a commit to yangguohao/community that referenced this pull request Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants