array-api-tests icon indicating copy to clipboard operation
array-api-tests copied to clipboard

Issue with test_clip

Open ndgrigorian opened this issue 8 months ago • 1 comments

    | Falsifying example: test_clip(
    |     x=array(0, dtype=uint8),
    |     data=data(...),
    | )
    | Draw 1 (min.shape, max.shape): ((), ())
    | Draw 2 (min): array(0, dtype=uint8)
    | Draw 3 (max): array(0, dtype=uint16)
    | Draw 4 (kwargs): {'min': array(0, dtype=uint8), 'max': array(0, dtype=uint16)}

Per spec,

If either min or max is an array having a different data type than x, behavior is unspecified and thus implementation-dependent.

Clarified that behavior is only defined when x, min, and max resolve to arrays having the same data type.

It seems to me that this is a malformed test, and only cases where min and max are (or resolve to, but even that's a stretch per first condition) the type of x should be tested.

ndgrigorian avatar Apr 08 '25 06:04 ndgrigorian

Agreed, the 2024 spec clarification is pretty clear on arrays of different dtypes. There's also gh-339 which report issues for mixing float32 and float64. Here's a fix: gh-360

ev-br avatar Apr 08 '25 13:04 ev-br