pymc-devs / pymc-devs/pytensor

Switch Unique behavior from numpy < 2.0 to numpy >= 2.0

Open
#1,739 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance NumPy compatibility
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

The behavior changed regarding the shape of return_inverse. We patched our perform mode to behave like the old numpy, but we should change it now that we are only compatible with numpy 2.0

https://github.com/pymc-devs/pytensor/blob/bc0d670fd542b7276ad5af583bf87862a4334868/pytensor/tensor/extra_ops.py#L1229-L1242

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in pytensor/tensor/extra_ops.py at lines 1229-1242 and inspect the Unique perform-mode handling for return_inverse. Compare that behavior with NumPy 2.0 and confirm that the resulting inverse shape matches the NumPy 2.0 behavior; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.