Prevent numpy error for block diag on Windows when numpy>=2.0#4352
Open
jmamzax wants to merge 1 commit into
Open
Prevent numpy error for block diag on Windows when numpy>=2.0#4352jmamzax wants to merge 1 commit into
jmamzax wants to merge 1 commit into
Conversation
jmamzax
force-pushed
the
dev/jmamzax/test_block_diag_scipy_xpu
branch
from
July 15, 2026 09:24
3088206 to
ea3ed3f
Compare
BBBela
approved these changes
Jul 21, 2026
BBBela
left a comment
Contributor
There was a problem hiding this comment.
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
force-pushed
the
dev/jmamzax/test_block_diag_scipy_xpu
branch
from
July 23, 2026 13:23
ea3ed3f to
43a11b6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.int32when NumPy will be updated on CI. Issue: #4326