The below example demonstrates unexpected dpctl behavior for divide, floor_divide and remainder binary functions.
The issue is visible when one of the input has unsinged integer type, while another input is negative integer scalar.
Here is an example for divide:
import numpy, dpctl, dpctl.tensor as dpt
dpctl.__version__
# Out: '0.18.0dev0+73.gc81735a928'
dpt.divide(dpt.asarray(3, dtype='u4'), -2)
# Out: usm_ndarray(6.9849193e-10, dtype=float32)
numpy.divide(numpy.asarray(3, dtype='u4'), -2)
# Out: -1.5
dpt.divide(-4, dpt.asarray(3, dtype='u4'))
# Out: usm_ndarray(1.4316558e+09, dtype=float32)
numpy.divide(-4, numpy.asarray(3, dtype='u4'))
# Out: -1.3333333333333333
similar with floor_divide:
dpt.floor_divide(dpt.asarray(7, dtype='u4'), -2)
# Out: usm_ndarray(0, dtype=uint32)
numpy.floor_divide(numpy.asarray(7, dtype='u4'), -2)
# Out: -4
and remainder:
dpt.remainder(dpt.asarray(7, dtype='u4'), -2)
# Out: usm_ndarray(7, dtype=uint32)
numpy.remainder(numpy.asarray(7, dtype='u4'), -2)
# Out: -1
The below example demonstrates unexpected dpctl behavior for
divide,floor_divideandremainderbinary functions.The issue is visible when one of the input has unsinged integer type, while another input is negative integer scalar.
Here is an example for
divide:similar with
floor_divide:and
remainder: