Skip to content

Conversation

@unnir
Copy link

@unnir unnir commented May 30, 2018

Fix #6874

unnir added 2 commits May 30, 2018 21:13
fix the "RuntimeError: randperm is only implemented for CPU" issue
fix for the "RuntimeError: randperm is only implemented for CPU" issue.
@fmassa
Copy link
Member

fmassa commented May 30, 2018

Do we need this once we merge the CUDA implementation for randperm? I think that tolist fist casts to the CPU, is that right?

Copy link
Member

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

Yeah, this will still be good even with CUDA torch.randperm.


def __iter__(self):
return iter(torch.randperm(len(self.data_source)).tolist())
return iter(torch.randperm(len(self.data_source), device=RandomSampler._cpu).tolist())

This comment was marked as off-topic.

@ezyang
Copy link
Contributor

ezyang commented Jun 1, 2018

@pytorchbot retest this please

@yf225
Copy link
Contributor

yf225 commented Jun 6, 2018

CUDA randperm is now merged: #7606

@sytelus
Copy link

sytelus commented Jul 5, 2018

Just wondering if this PR is still required for the error RuntimeError: randperm is only implemented for CPU or does #7606 resolves this issue? It would be nice to get this issue resolved.

@fmassa
Copy link
Member

fmassa commented Jul 5, 2018

I think we can close this PR, as now that randperm supports cuda and tolist() passes everything to the CPU, this is not needed anymore I believe.

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.

[pytorch] randperm lacks CUDA implementation

8 participants