Skip to content

NumPy dev test failures #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
asmeurer opened this issue Jul 29, 2024 · 2 comments
Closed

NumPy dev test failures #167

asmeurer opened this issue Jul 29, 2024 · 2 comments

Comments

@asmeurer
Copy link
Member

Several tests for NumPy dev fail. What's concerning is that these don't seem to show up on CI, despite the CI apparently running the latest version of the test suite and installing the latest version of NumPy. See for instance https://github.com/data-apis/array-api-compat/actions/runs/10149966468/job/28066028900, which is definitely installing the right version of the test suite https://github.com/data-apis/array-api-compat/actions/runs/10149966468/job/28066028900#step:3:101, and definitely testing against numpy 2.1.0-dev https://github.com/data-apis/array-api-compat/actions/runs/10149966468/job/28066028900#step:7:24

FAILED array_api_tests/test_operators_and_elementwise_functions.py::test_clip - AssertionError: out.dtype=int64, but should be uint32 [clip(uint32)]
Falsifying example: test_clip(
    x=array([65535, 35892, 35892, 35892, 35892], dtype=uint32),
    data=data(...),
)
Draw 1 (min.shape, max.shape): ((), ())
Draw 2 (min): None
Draw 3 (max): array(0, dtype=int8)
Draw 4 (kwargs): {'max': array(0, dtype=int8)}
FAILED array_api_tests/test_set_functions.py::test_unique_inverse - TypeError: Input should be a NumPy array. It is a <class 'numpy.bool'> instead.
Falsifying example: test_unique_inverse(
    x=array(0., dtype=float32),
)
Explanation:
    These lines were always and only run by failing examples:
        /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/dtype_helpers.py:187
        /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:38
        /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:45
        /Users/aaronmeurer/Documents/numpy/numpy/_core/getlimits.py:491
FAILED array_api_tests/test_set_functions.py::test_unique_values - TypeError: Input should be a NumPy array. It is a <class 'numpy.bool'> instead.
Falsifying example: test_unique_values(
    x=array(0., dtype=float32),
)
Explanation:
    These lines were always and only run by failing examples:
        /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/dtype_helpers.py:187
        /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:38
        /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:45
        /Users/aaronmeurer/Documents/numpy/numpy/_core/getlimits.py:491
FAILED array_api_tests/test_signatures.py::test_func_signature[argsort] - AssertionError: Argument 'descending' missing from signature
assert 'descending' in odict_keys(['a', 'axis', 'kind', 'order', 'stable'])
 +  where 'descending' = <Parameter "descending: bool = False">.name
 +  and   odict_keys(['a', 'axis', 'kind', 'order', 'stable']) = <built-in method keys of mappingproxy object at 0x11b70e0b0>()
 +    where <built-in method keys of mappingproxy object at 0x11b70e0b0> = mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})).keys
 +      where mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})) = <Signature (a, axis=-1, kind=None, order=None, *, stable=None)>.parameters
FAILED array_api_tests/test_signatures.py::test_func_signature[sort] - AssertionError: Argument 'descending' missing from signature
assert 'descending' in odict_keys(['a', 'axis', 'kind', 'order', 'stable'])
 +  where 'descending' = <Parameter "descending: bool = False">.name
 +  and   odict_keys(['a', 'axis', 'kind', 'order', 'stable']) = <built-in method keys of mappingproxy object at 0x11ae295d0>()
 +    where <built-in method keys of mappingproxy object at 0x11ae295d0> = mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})).keys
 +      where mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})) = <Signature (a, axis=-1, kind=None, order=None, *, stable=None)>.parameters
FAILED array_api_tests/test_signatures.py::test_func_signature[clip] - AssertionError: Expected argument 'a_min' to be named 'min'
assert 'a_min' == 'min'

  - min
  + a_min
  ? ++
FAILED array_api_tests/test_sorting_functions.py::test_argsort - TypeError: argsort() got an unexpected keyword argument 'descending'
Falsifying example: test_argsort(
    x=array([0], dtype=uint8),  # or any other generated value
    data=data(...),
)
Draw 1 (kw): {'descending': False}
FAILED array_api_tests/test_sorting_functions.py::test_sort - TypeError: sort() got an unexpected keyword argument 'descending'
Falsifying example: test_sort(
    x=array([15, 15, 15, 15], dtype=uint8),
    data=data(...),
)
Draw 1 (kw): {'descending': False}
@asmeurer
Copy link
Member Author

Right, it's testing the compat layer, because the CI just tests the module directly, so it's unrelated to the array_namespace logic that skips the compat layer. We need to just get rid of that logic for NumPy, since 2.0 and 2.1 both do have some incompatibilities. We could lighten the wrapping for 2.0 so that unnecessary things aren't wrapped, although I don't know if that complexity is worth it. The main benefit would be performance. I guess we should see if there is a meaningful difference.

@asmeurer
Copy link
Member Author

These tests all pass against the wrapped namespace, so these test failures are an issue for upstream NumPy (or in the case of some of them, the test suite).

@asmeurer asmeurer closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2024
asmeurer added a commit to asmeurer/array-api-compat that referenced this issue Jul 30, 2024
NumPy 2.0 and 2.1 both have some incompatibilities with the array API (see data-apis#167 and data-apis#164).

Closes data-apis#168.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant