Bitwise elementwise functions#1307
Conversation
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1307/index.html |
|
Array API standard conformance tests for dpctl= ran successfully. |
84f9109 to
8a2b1d4
Compare
|
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_54 ran successfully. |
dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp
Show resolved
Hide resolved
Implements bitwise_invert, bitwise_and, bitwise_or, bitwise_xor, bitwise_left_shift, and bitwise_right_shift Implements Python API in _tensor_impl for these functions.
Adds tensor.bitwise_invert, tensor.bitwise_and, tensor.bitwise_or, tensor.bitwise_xor, tensor.bitwise_left_shift, tensor.bitwise_right_shift
8a2b1d4 to
d92695a
Compare
|
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_70 ran successfully. |
…ined behavior The array API extends the definition to defined bitshift operators to be zero for shift-size outside of bitwidth range. ``` In [1]: import dpctl.tensor as dpt, numpy as np In [2]: x = dpt.asarray([1, 1]) In [3]: y = dpt.asarray(64) In [4]: dpt.bitwise_right_shift(x, y) Out[4]: usm_ndarray([0, 0]) In [5]: x_np, y_np = dpt.asnumpy(x), dpt.asnumpy(y) In [6]: np.right_shift(x_np, y_np) Out[6]: array([0, 0]) ```
|
@oleksandr-pavlyk |
And oddly enough: which is the expected result. |
|
@ndgrigorian C/C++ spec states that bitshift behavior is undefined if the second argument is negative or not less than total type bitwidth. Additional branching was added ensure compliance with spec. |
|
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_77 ran successfully. |
ndgrigorian
left a comment
There was a problem hiding this comment.
Test is fixed so LGTM!
|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
|
Array API standard conformance tests for dpctl=0.14.6dev0=py310h7bf5fec_77 ran successfully. |
Implementation of
dpt.bitwise_invert,dpt.bitwise_and,dpt.bitwise_or,dpt.bitwise_xor,dpt.bitwise_left_shift, anddpt.bitwise_right_shiftper array API.