Open vlad-perevezentsev opened 1 week ago
I would like to offer a correction that not only bool is supported, it depends on the expected output type of the elementwise functions.
logical_not
expects to output a boolean array, so only accepts a boolean array as out
. Something like sqrt
expects to output floating-point data, so only accepts floating-point data type arrays for out
. The reason for this being that for the output array of the function to actually be the same array as the out
array, it needs to be the appropriate data type, since we can't cast the array data in-place. In such a case, the returned array would not be the same as the user input out
.
Current implementations of elementwise functions in dpctl.tensor do not support
out
data type other thanbool
and raiseValueError
ifout
is notbool
.While numpy can cast the result depending on
out
data type.Since the Python Array API has no description for
out
parameter we can implement any logic we want. I think it would be useful to follow the logic of numpy and cast the result depending onout
data type.