-
Notifications
You must be signed in to change notification settings - Fork 30
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
Implements dpctl.tensor.clip
#1444
Conversation
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1444/index.html |
Encountered
|
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_45 ran successfully. |
This is currently the expected behavior, as the output is expected to be the same type as the input, and a float can't be cast to int. |
Checked with existing dpnp tests around |
189d2d5
to
0df7721
Compare
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_45 ran successfully. |
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_46 ran successfully. |
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_50 ran successfully. |
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_53 ran successfully. |
@oleksandr-pavlyk Then for instance |
@ndgrigorian I think |
sycl::clamp would yield max or min depending on the platform A test has been added for this behavior
As the result dtype of the out array is already checked when overlap is checked, checking again later is superfluous
Now properly accounts for all three arrays in all branches
37210ec
to
4366943
Compare
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_70 ran successfully. |
4366943
to
b42d78b
Compare
Making this change was more breaking than expected for elementwise functions. It will belong in a separate PR, as it will have to touch a lot of tests and unary functions. There are also other cases where inappropriate dtype of an input array leads to a For now, that work is done on just clip. The PR is ready for review. |
b42d78b
to
d839124
Compare
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_70 ran successfully. |
Array API standard conformance tests for dpctl=0.15.1dev0=py310ha25a700_70 ran successfully. |
This pull request implements the function
clip
, for clipping elements of an array to a range.Clip permits both Python scalar and
dpctl.tensor.usm_ndarray
arguments for itsmin
andmax
arguments.An example of the new functionality: