Skip to content

Issues with test_clip #276

Closed
Closed
@asmeurer

Description

@asmeurer
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 1043, in test_clip
    |     assert out_val == expected, (
    | AssertionError: out[()]=0.0 but should be 4.0311033624323596e-209 [clip()]
    |   x[()]=0.0, min[()]=4.0311033624323596e-209, max[()]=1.0
    | assert 0.0 == 4.0311033624323596e-209
    | Falsifying example: test_clip(
    |     x=Array(0., dtype=array_api_strict.float32),
    |     data=data(...),
    | )
    | Draw 1 (min.shape, max.shape): ((), ())
    | Draw 2 (min): Array(4.03110336e-209, dtype=array_api_strict.float64)
    | Draw 3 (max): Array(1., dtype=array_api_strict.float32)
    | Draw 4 (kwargs): {'min': Array(4.03110336e-209, dtype=array_api_strict.float64),
    |  'max': Array(1., dtype=array_api_strict.float32)}
    | Explanation:
    |     These lines were always and only run by failing examples:
    |         /Users/aaronmeurer/Documents/array-api-strict/array_api_strict/_array_object.py:113
    |         /Users/aaronmeurer/Documents/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py:1046
    |         /Users/aaronmeurer/miniconda3/envs/array-apis/lib/python3.12/site-packages/numpy/core/arrayprint.py:1590
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/test_operators_and_elementwise_functions.py", line 952, in test_clip
    |     assume(min is None or max is None or not xp.any(xp.asarray(min) > xp.asarray(max)))
    |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/aaronmeurer/Documents/array-api-strict/array_api_strict/_array_object.py", line 641, in __gt__
    |     other = self._check_allowed_dtypes(other, "real numeric", "__gt__")
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/aaronmeurer/Documents/array-api-strict/array_api_strict/_array_object.py", line 179, in _check_allowed_dtypes
    |     res_dtype = _result_type(self.dtype, other.dtype)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/aaronmeurer/Documents/array-api-strict/array_api_strict/_dtypes.py", line 217, in _result_type
    |     raise TypeError(f"{type1} and {type2} cannot be type promoted together")
    | TypeError: array_api_strict.int64 and array_api_strict.uint64 cannot be type promoted together
    | Falsifying example: test_clip(
    |     x=Array(0, dtype=array_api_strict.uint64),
    |     data=data(...),
    | )
    | Draw 1 (min.shape, max.shape): ((), ())
    | Draw 2 (min): 0
    | Draw 3 (max): 9223372036854775808
    | Explanation:
    |     These lines were always and only run by failing examples:
    |         /Users/aaronmeurer/Documents/array-api-strict/array_api_strict/_dtypes.py:217
    +------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions