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

Complete implementation of cp.random.choice() #8293

Open
FloWsnr opened this issue Apr 16, 2024 · 2 comments
Open

Complete implementation of cp.random.choice() #8293

FloWsnr opened this issue Apr 16, 2024 · 2 comments
Labels

Comments

@FloWsnr
Copy link

FloWsnr commented Apr 16, 2024

Description

Hi guys,

First of all, thank you for the amazing work.
I'm interested in using cp.random.choice with replace=False as well as a given probability array.
Currently this feature is not implemented. see here

Before I just write my own version of this function, I'd like to try and add the functionality to cupy. Since this would be my first contribution to cupy, I'd like to get some starter help...

Questions:

  1. Are there any ongoing efforts / PRs to do that?
  2. The choice function for the Generator class is completely missing. Is it worth it to add the functionality to cp.random.choice or should I directly try to add the choice function to the Generator class?
  3. Am I understanding the code correctly?
  • _sample.py just calls _generator.py (old random functions)
  • _generator_api.pyx is the new Generator class
  1. Since I am no cuda/Cython pro: Why is the old choice function exclusively in python while the new Generator class requires Cython?

Additional Information

No response

@kmaehashi
Copy link
Member

Hi, thanks for your interest in contributing to CuPy! Random API coverages are tracked in #4557. I haven't assessed in detail but supporting replace=False will likely require familiarity with CUDA, even implementing it naively with syncthreads to prevent the same index to be picked.

@kmaehashi kmaehashi removed their assignment Apr 17, 2024
@FloWsnr
Copy link
Author

FloWsnr commented Apr 18, 2024

Thank you for the fast response.
Alright, I`ll try and see how far I can get...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants