Skip to content
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

Numpy 2.0 #689

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

Numpy 2.0 #689

wants to merge 12 commits into from

Conversation

Armavica
Copy link
Member

@Armavica Armavica commented Apr 3, 2024

Description

Ruff suggested a few things to change but I cannot test because I install both numpy=2.0.0.rc1 and numba (any version including the most recent 0.59.1) (incompatibilities in python abi).

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@ricardoV94 ricardoV94 force-pushed the numpy2 branch 3 times, most recently from 28bb96a to 2808634 Compare April 5, 2024 10:50
@ricardoV94
Copy link
Member

ricardoV94 commented Apr 5, 2024

Removed the custom Complex C types... I have no context as to why they were necessary, so that definitely needs careful review.

This is code that seems to have been there mostly from the beginning.

Edit seems to be needed to define operations like * :(

@ricardoV94 ricardoV94 added major NumPy compatibility dependencies Pull requests that update a dependency file C-backend labels Apr 5, 2024
@ricardoV94 ricardoV94 force-pushed the numpy2 branch 2 times, most recently from d83b37d to eca375b Compare April 5, 2024 11:10
@Armavica
Copy link
Member Author

Armavica commented Apr 6, 2024

Edit seems to be needed to define operations like * :(

In what context? If it is in array indexing, then this syntax was only added on Python 3.11 (I found out recently about this).

@ricardoV94
Copy link
Member

ricardoV94 commented Apr 6, 2024

No, this is C(++) code, multiplication of complex scalars.

Maybe @michaelosthege finds this interesting xD?

These are the breaking changes: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#complex-types-underlying-type-changes

maresb added a commit to maresb/pytensor that referenced this pull request Apr 6, 2024
This will help with publishing a repodata patch for conda-forge as per
<pymc-devs#688 (comment)>.
This will no longer be necessary when we are finished with
<pymc-devs#689>.
@maresb maresb mentioned this pull request Apr 6, 2024
11 tasks
ricardoV94 pushed a commit that referenced this pull request Apr 6, 2024
This will help with publishing a repodata patch for conda-forge as per
<#688 (comment)>.
This will no longer be necessary when we are finished with
<#689>.
@maresb
Copy link
Contributor

maresb commented Apr 6, 2024

Friendly note that it will be necessary to revert 1235d08 on the next rebase in order to unpin numpy<2.

Copy link
Member

@michaelosthege michaelosthege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is C(++) code, multiplication of complex scalars.

Maybe @michaelosthege finds this interesting xD?

These are the breaking changes: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#complex-types-underlying-type-changes

I don't usually write C, but when I do it's for EPS32 microcontrollers, so I have zero clue about this NumPy C stuff 😄

@@ -3144,7 +2985,7 @@ def L_op(self, inputs, outputs, gout):
else:
return [x.zeros_like()]

return (gz * exp2(x) * log(np.cast[x.type](2)),)
return (gz * exp2(x) * log(np.asarray(2, dtype=x.type)),)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like they could be cherry-picked and applied already?

@twiecki
Copy link
Member

twiecki commented May 30, 2024

Now with numpy 2.0 released it would be nice to be compatible with it.

@ricardoV94
Copy link
Member

ricardoV94 commented May 30, 2024

Now with numpy 2.0 released it would be nice to be compatible with it.

There's some esoteric C++ code for complex variables that I didn't want to dig too much into

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-backend dependencies Pull requests that update a dependency file major NumPy compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test on numpy 2.0
5 participants