allow RandomSampler to sample with replacement#9911
allow RandomSampler to sample with replacement#9911weiyangfb wants to merge 3 commits intopytorch:masterfrom
Conversation
facebook-github-bot
left a comment
There was a problem hiding this comment.
@weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
There was a problem hiding this comment.
@weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
apaszke
left a comment
There was a problem hiding this comment.
Test needs a fix or it will be flaky. Apart from that LGTM.
test/test_dataloader.py
Outdated
| count_repeated = 0 | ||
| for val in bin.values(): | ||
| if val > 1: | ||
| count_repeated += 1 |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
test/test_dataloader.py
Outdated
| self.assertTrue(maxval < n) | ||
|
|
||
| sampler_without_replacement = RandomSampler(self.dataset) | ||
| count_repeated, minval, maxval = sample_stat(sampler_without_replacement, n) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| n = len(self.dataset) | ||
| sampler_with_replacement = RandomSampler(self.dataset, n, True) | ||
| count_repeated, minval, maxval = sample_stat(sampler_with_replacement, n) | ||
| self.assertTrue(count_repeated > 0) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@pytorchbot retest this please |
f0e0af4 to
d3f4e91
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: fixes pytorch#7908 Pull Request resolved: pytorch#9911 Reviewed By: yf225 Differential Revision: D9023223 Pulled By: weiyangfb fbshipit-source-id: 68b199bef3940b7205d0fdad75e7c46e6fe65ba7
fixes #7908