Skip to content

randperm on cuda looks buggy #22710

@gchanan

Description

@gchanan

I was looking at #22103 (thanks @xuhdev!) and I noticed a couple of issues with the previous implementation (i.e. #22103 didn't introduce them).

  1. The code looks wrong for non-contiguous tensors; it does a resize but that's not guaranteed to give you a contiguous tensor.
  2. It's surprising (and does it not cause a problem in all cases?) to use a CPU generator when you passed (potentially) in the CUDA one. And it would at least be surprising to mess with a different pseudo random stream than you passed in, even if it doesn't cause a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    high prioritymodule: randomRelated to random number generation in PyTorch (rng generator)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions