Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dedicated handling for cudf.pandas wrapped Numpy arrays (#5861)
Without the dedicated if branch the wrapped arrays end up being treated like a cupy array because they define `__cuda_array_interface__`. Is this the right place to change this? I don't know anything about the input handling cuml does, but it seems like adding a special case here leads to the desired result. Is returning a real numpy array what we want to do? Returning a cudf.pands wrapped numpy array feels like the even better thing to do? But I couldn't work out how to do that :-/ A downside of this approach is that we import a private part of cudf. However, I don't know if there is a way to avoid this if we want to use `isinstance`. We could use something like `hasattr(X, "_fsproxy_fast_type")` (or some other special method `cudf.pandas` defines). A pro for using the special method check would be that it has no side effects. Importing `cudf.pandas._wrappers` has the side effect of turning on pandas compatibility mode. This leads to a test failure in `LabelEncoder`. Thinking about it, I think as a user of cuml I'd be surprised that it messes with the cudf settings for me. So I think I will switch to using `hasattr`. Does someone know if there is an officially supported way to test "is this a cudf.pandas wrapped object?"? I had a quick look at the cudf docs but they are sparse when it comes to developer topics like this. An official way to check this might be even better than relying on special methods existing. Closes #5784 * [x] add non regression test * [ ] add second run of `pytest` with `pytest -p cudf.pandas ...` to execute regression test * As a first pass I think it would be neat to be able to run the whole test suite with cudf.pandas enabled * this is a bit tricky because other tests might start failing when executed with cudf.pandas enabled Authors: - Tim Head (https://github.com/betatim) Approvers: - Dante Gama Dessavre (https://github.com/dantegd) - Matthew Roeschke (https://github.com/mroeschke) URL: #5861
- Loading branch information