Skip to content

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

Closed
jklymak wants to merge 1 commit into
matplotlib:mainfrom
jklymak:fix-reshape_2D
Closed

jklymak wants to merge 1 commit into
matplotlib:mainfrom
jklymak:fix-reshape_2D

Conversation

@jklymak

@jklymak jklymak commented Jan 29, 2024

Copy link
Copy Markdown
Member

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

jklymak commented Jan 29, 2024

Copy link
Copy Markdown
Member Author

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