You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
binops correctly raise when the user tries to mix int, float, and bool dtypes, and in general in all use cases that the Type Promotion Rules declare as "undefined behaviour".
__setitem__ however quietly casts the rhs to the dtype of the input.
>>>importarray_api_strictasxp>>>a=xp.asarray([1,2])
>>>b=xp.asarray(3.5)
>>>xp.maximum(a, b)
TypeError: array_api_strict.int64andarray_api_strict.float64cannotbe type promotedtogether>>>xp.maximum(a, 3.5)
TypeError: Pythonfloatscalarscanonlybepromotedwithfloating-pointarrays.
>>>a[0] =b# No error>>>a[1] =4.5# No error>>>aOut[12]: Array([3, 4], dtype=array_api_strict.int64)
__setitem__
when the assigned value promotes to the array's dtype array-api#916binops correctly raise when the user tries to mix int, float, and bool dtypes, and in general in all use cases that the Type Promotion Rules declare as "undefined behaviour".
__setitem__
however quietly casts the rhs to the dtype of the input.__iadd__
et al behave as expected:The text was updated successfully, but these errors were encountered: