Skip to content

Commit d2052ea

Browse files
ccoulombepytorchmergebot
authored andcommitted
Update test_multiarray.py to support numpy 2.0+ (pytorch#138461)
Import _core instead of core. Addresses partially pytorch#137182 Pull Request resolved: pytorch#138461 Approved by: https://github.com/ezyang, https://github.com/albanD
1 parent 4c6ae39 commit d2052ea

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/torch_np/numpy_tests/core/test_multiarray.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@
7575
IS_PYSTON = False
7676
HAS_REFCOUNT = True
7777

78-
from numpy.core.tests._locales import CommaDecimalPointLocale
78+
if numpy.__version__ > "2":
79+
# numpy 2.0 +, see https://numpy.org/doc/stable/release/2.0.0-notes.html#renamed-numpy-core-to-numpy-core
80+
from numpy._core.tests._locales import CommaDecimalPointLocale
81+
else:
82+
from numpy.core.tests._locales import CommaDecimalPointLocale
83+
7984
from numpy.testing._private.utils import _no_tracing, requires_memory
8085

8186

0 commit comments

Comments
 (0)