Skip to content

Prevent numpy error for block diag on Windows when numpy>=2.0#4352

Open
jmamzax wants to merge 1 commit into
intel:mainfrom
jmamzax:dev/jmamzax/test_block_diag_scipy_xpu
Open

Prevent numpy error for block diag on Windows when numpy>=2.0#4352
jmamzax wants to merge 1 commit into
intel:mainfrom
jmamzax:dev/jmamzax/test_block_diag_scipy_xpu

Conversation

@jmamzax

@jmamzax jmamzax commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

From version 2.0 NumPy on Windows uses int64 as default integer: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#windows-default-integer. Checking NumPy version will prevent from the error AssertionError: Object comparison failed: torch.int64 != torch.int32 when NumPy will be updated on CI. Issue: #4326

@jmamzax jmamzax added windows_ci Only for Windows CI trigger disable_e2e Disable all e2e test jobs for the PR disable_distributed Disable distributed UT test jobs for the PR disable_accelerate Disable accelerate test job in PR CI testing disable_transformers Disable transformers UT test in PR CI labels Jul 15, 2026
@github-actions github-actions Bot added the disable_build Disable source code build for CI test, use nightly wheel label Jul 15, 2026
@jmamzax
jmamzax force-pushed the dev/jmamzax/test_block_diag_scipy_xpu branch from 3088206 to ea3ed3f Compare July 15, 2026 09:24

@BBBela BBBela left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, thanks!

Functionally it is okay, but I thought about separating this conditional check - something like that:

        # numpy < 2.0 on Windows used int32 as the default integer type
        # numpy >= 2.0 uses int64 everywhere
        scipy_int_type = (
            torch.int32
            if IS_WINDOWS and np.lib.NumpyVersion(np.__version__) < "2.0.0"
            else torch.int64
        )

        expected_scipy_types = [
            torch.float64,
            scipy_int_type,
            torch.complex128,
            torch.float64,
        ]

But that is just a suggestion - approving anyway 😉

@jmamzax
jmamzax force-pushed the dev/jmamzax/test_block_diag_scipy_xpu branch from ea3ed3f to 43a11b6 Compare July 23, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disable_accelerate Disable accelerate test job in PR CI testing disable_build Disable source code build for CI test, use nightly wheel disable_distributed Disable distributed UT test jobs for the PR disable_e2e Disable all e2e test jobs for the PR disable_transformers Disable transformers UT test in PR CI windows_ci Only for Windows CI trigger

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants