-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed as not planned
Labels
array typesItems related to array API support and input array validation (see gh-18286)Items related to array API support and input array validation (see gh-18286)duplicateIssues that describe the same problem or that are reported multiple timesIssues that describe the same problem or that are reported multiple timesmaintenanceItems related to regular maintenance tasksItems related to regular maintenance tasksscipy._lib
Description
In [10]: from scipy._lib._array_api import xp_assert_close, xp_assert_equal
In [11]: a = np.array(42)
In [12]: xp_assert_equal(a, a)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[12], line 1
----> 1 xp_assert_equal(a, a)
[... skipping hidden 2 frame]
File ~/repos/scipy/scipy/build-install/lib/python3.10/site-packages/scipy/_lib/_array_api.py:290, in _check_scalar(actual, desired, xp)
288 desired = desired[()]
289 _msg = f"Types do not match:\n Actual: {type(actual)}\n Desired: {type(desired)}"
--> 290 assert (xp.isscalar(actual) and xp.isscalar(desired)
291 or (not xp.isscalar(actual) and not xp.isscalar(desired))), _msg
AssertionError: Types do not match:
Actual: <class 'numpy.ndarray'>
Desired: <class 'numpy.int64'>
In [13]: xp_assert_close(a, a)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[13], line 1
----> 1 xp_assert_close(a, a)
[... skipping hidden 2 frame]
File ~/repos/scipy/scipy/build-install/lib/python3.10/site-packages/scipy/_lib/_array_api.py:290, in _check_scalar(actual, desired, xp)
288 desired = desired[()]
289 _msg = f"Types do not match:\n Actual: {type(actual)}\n Desired: {type(desired)}"
--> 290 assert (xp.isscalar(actual) and xp.isscalar(desired)
291 or (not xp.isscalar(actual) and not xp.isscalar(desired))), _msg
AssertionError: Types do not match:
Actual: <class 'numpy.ndarray'>
Desired: <class 'numpy.int64'>
Metadata
Metadata
Assignees
Labels
array typesItems related to array API support and input array validation (see gh-18286)Items related to array API support and input array validation (see gh-18286)duplicateIssues that describe the same problem or that are reported multiple timesIssues that describe the same problem or that are reported multiple timesmaintenanceItems related to regular maintenance tasksItems related to regular maintenance tasksscipy._lib