Skip to content

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

@IamTingTing

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

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