Skip to content

Array API cupy fixes #27672

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

Closed
wants to merge 6 commits into from
Closed

Conversation

ogrisel
Copy link
Member

@ogrisel ogrisel commented Oct 26, 2023

I found a few problems when running the existing Array API tests on a machine with CUDA and cupy.

There are a few easy fixes but there is also a problem with train_test_split that I did not solve yet.

I don't understand why the existing tests pass with the strict numpy.array_api: we should not be able to fancy index an Array using array[indices, ...] but instead we should use array.take(indices, axis=0). This needs more investigation but I decided to open an early draft PR to share the existence of the problem with @betatim and others.

@betatim
Copy link
Member

betatim commented Oct 27, 2023

Was expecting to see a modification to train_test_split but there isn't? I'm confused

But I agree (now that you say it) that xp.take should be the way to do this.

@betatim
Copy link
Member

betatim commented Oct 27, 2023

Even more confusingly, if I use main and run the following code it works?

import cupy as cp
from sklearn import set_config
from sklearn.model_selection import train_test_split

set_config(array_api_dispatch=True)
X = cp.random.random_sample((42, 4), dtype=cp.float32)
train_test_split(X)

@ogrisel
Copy link
Member Author

ogrisel commented Mar 21, 2024

Fixed in #28407.

@ogrisel ogrisel closed this Mar 21, 2024
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.

2 participants