Skip to content

Unit test fails with NumPy 2.3.1 but passes with NumPy 1.26.4 #8520

Closed

Description

@IamTingTing

Describe the bug
A unit test tests.transforms.test_signal_remove_frequency.TestSignalRemoveFrequencyNumpy.test_correct_parameters_multi_channels_0 fails when using NumPy 2.3.1, but passes when downgraded to NumPy 1.26.4.

To Reproduce

  1. Create a conda env with:
  • monai==1.5.0
  • numpy==2.3.1
  • torch==2.6.0+cu126
  • torchaudio==2.6.0+cu126
  • other related packages
  1. Run python -m unittest tests.transforms.test_signal_remove_frequency
  2. See test failure
    AssertionError:
    Not equal to tolerance rtol=1e-05, atol=0

Expected behavior
Tests should pass consistently across supported NumPy versions.

Environment

================================
Printing system config...
================================
System: Linux
Linux version: Ubuntu 24.04.1 LTS
Platform: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.39
Processor: x86_64
Machine: x86_64
Python version: 3.12.11
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Num physical CPUs: 6
Num logical CPUs: 6
Num usable CPUs: 6
CPU usage (%): [6.8, 2.4, 3.1, 3.9, 3.9, 92.2]
CPU freq. (MHz): 3696
Load avg. in last 1, 5, 15 mins (%): [1.3, 0.5, 0.1]
Disk usage (%): 12.5
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 25.0
Available memory (GB): 22.1
Used memory (GB): 2.5

================================
Printing GPU config...
================================
Num GPUs: 1
Has CUDA: True
CUDA version: 12.6
cuDNN enabled: True
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None
cuDNN version: 90501
Current device: 0
Library compiled for CUDA architectures: ['sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_90']
GPU 0 Name: NVIDIA GeForce RTX 4060 Ti
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 34
GPU 0 Total memory (GB): 16.0
GPU 0 CUDA capability (maj.min): 8.9

Activity

  1. ericspod commented on Aug 12, 2025

    @ericspod
    Member

    Hi @IamTingTing thanks for point this out. I have created a PR which I think fixes the issue but I'll wait for all tests to pass to see if it works across versions. Please have a look to see if this fixes your issue.

  2. IamTingTing commented on Aug 14, 2025

    @IamTingTing
    ContributorAuthor

    Hi @ericspod thanks for the fix!
    I’ve tested the PR on my environment with NumPy 2.3.1 and can confirm the unit test now passes.

  3. dzenanz commented on Aug 18, 2025

    @dzenanz
    Contributor

    Has that PR been merged now? Can this issue be closed?

  4. IamTingTing commented on Aug 22, 2025

    @IamTingTing
    ContributorAuthor

    Hi @dzenanz ,thank you for following up. Since the PR is not yet merged, I think it would be better to keep this issue open until the changes are included in main.

  5. ericspod commented on Aug 31, 2025

    @ericspod
    Member

    We should get #8537 through soon, we're sorting out a CI issue currently.

  6. ericspod commented on Feb 23, 2026

    @ericspod
    Member

    This should now be addressed by #8738.

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