-
Notifications
You must be signed in to change notification settings - Fork 45
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
test_clip: make sure min
and max
have the same dtype as x
#360
base: master
Are you sure you want to change the base?
Conversation
Per the spec: 'should have the same dtype as x'
Run tests with |
Tested the branch (running with 2_000 examples) locally and can verify that it resolves gh-359 for dpctl.tensor |
Definitely the spec should clarify that int scalars should be cast to float. |
@@ -987,17 +987,15 @@ def test_clip(x, data): | |||
base_shape=x.shape), | |||
label="min.shape, max.shape") | |||
|
|||
dtypes = hh.real_floating_dtypes if dh.is_float_dtype(x.dtype) else hh.int_dtypes | |||
|
|||
min = data.draw(st.one_of( | |||
st.none(), | |||
hh.scalars(dtypes=st.just(x.dtype)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this misses out on the use case clip(Array[float], int)
#364
closes gh-359, closes gh-339
Per the spec: 'should have the same dtype as x': https://data-apis.org/array-api/latest/API_specification/generated/array_api.clip.html
The spec is not very clear on whether
min
andmax
can beint
scalars for a real-valuedx
array, should probably clarify in the spec: