Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT/ENH: make hist and friends more forgiving of array-like #27714

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 1 commit into from

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Jan 29, 2024

This is an alternate to #25887.

Not sure it is correct yet, but the idea is

  1. special carve out if X has iloc. Basically pandas.
  2. Instead of doing array-like logic on ndarrays, it does them if X has ndim and T, both of which are required.
    • Tensor satisfies this
    • Jax has ndim. I was a little unclear if it supports T, but it has a transpose method, so I expect it does.
  3. rest is the same.

Still needs testing that these array-like libraries work. But if a numpy-like array doesn't support X.T and X.ndim....

PR summary

PR checklist

@jklymak jklymak marked this pull request as draft January 29, 2024 03:09
@jklymak
Copy link
Member Author

jklymak commented Jan 29, 2024

OK, this works fine, but doesn't speed up jax/torch.

The basic problem now is that a JAX Array gets sent to process_unit_info and that is slow. But we can't turn everything to a numpy array before process_unit_info or it drops units from Quantity.

I'll close this as its basically a Gordian knot, and I agree that if we want to allow jax/tensor then a cutout as in #25887 is probably the best we can do.

@jklymak jklymak closed this Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant