Skip to content

[ENH] address __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions #1855

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented May 29, 2025

Fixes #1764.

The reason is that numpy 2 added additional arguments to __array_wrap__ which was interacting with torch.Tensor.__array_wrap__ or pandas.Series.__array_wrap__ that did not have said arguments on earlier versions, in TorchNormalizer.

The warning can be avoided by explicit coercion to torch prior to mixed usage - avoiding mixed types across packages entirely.

This also makes the coercions more explicit, enabling future refactors where we may want to move to more "clean" type assumptions instead of polymorphic union types.

@fkiraly fkiraly requested a review from benHeid as a code owner May 29, 2025 09:00
@fkiraly fkiraly added the enhancement New feature or request label May 29, 2025
@fkiraly fkiraly changed the title [ENH] adderss __array_wrap__ change incompatibility between numpy 2 and early torch versions [ENH] adderss __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions May 29, 2025
@fkiraly fkiraly changed the title [ENH] adderss __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions [ENH] address __array_wrap__ change incompatibility between numpy 2 and early torch or pandas versions May 29, 2025
@fkiraly fkiraly marked this pull request as draft May 29, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] address numpy 2 deprecations
1 participant