Skip to content

np.product used in operators/ raises AttributeError on NumPy 2.0 #37

Open

Description

@SID-6921

Description

operators/common/Operator.py and operators/op_reconstruction/GRU.py call np.product(shape). NumPy 2.0 removed np.product (see the NumPy 2.0 migration guide: "product" -> use np.prod instead).

Since requirements.txt pins numpy>="1.19.5" with no upper bound, a fresh pip install -r requirements.txt today installs NumPy 2.x, so this is reachable immediately.

Repro

Run the op reconstruction test suite (operators/test.py). Gather.py calls run_comparison(..., incremental_vals=True), which hits the np.product line in Operator.py:164 and raises:

AttributeError: module ''numpy'' has no attribute ''product''

Fix

Replace np.product with np.prod in:

  • operators/common/Operator.py
  • operators/op_reconstruction/GRU.py (same dead API, latent until incremental_vals=True is passed to its run_comparison override)

I have a one-line fix for both ready to submit as a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions