The example below works differently with numpy:
import numpy as np, dpctl, dpctl.tensor as dpt
np.__version__
# Out: '2.2.4'
dpctl.__version__
# Out: '0.20.0dev0+71.gc5d18f4b6f'
a = np.ones(5, dtype='?')
ia = dpt.ones(5, dtype='?')
np.ceil(a).dtype
# Out: dtype('bool')
np.trunc(a).dtype
# Out: dtype('bool')
np.floor(a).dtype
# Out: dtype('bool')
dpt.ceil(ia).dtype
# Out: dtype('int8')
dpt.trunc(ia).dtype
# Out: dtype('int8')
dpt.floor(ia).dtype
# Out: dtype('int8')
In overall, it seems Python array API standard requires dtype of output array to be matched with dtype of input array:
out (array) – an array containing the rounded result for each element in x. The returned array must have the same data type as x.
Although the support of bool dtypes is not mandated:
x (array) – input array. Should have a real-valued data type.
It sounds like if dpctl provides the support of bool dtype, it has to return out array of bool dtype also.
The example below works differently with numpy:
In overall, it seems Python array API standard requires dtype of output array to be matched with dtype of input array:
Although the support of bool dtypes is not mandated:
It sounds like if dpctl provides the support of bool dtype, it has to return out array of bool dtype also.