dpnp
dpnp copied to clipboard
BUG: Compute-follows-data breaks on the inverse operation
x = dpnp.asarray([1.0, 2.0, 3.0])
y = 1.0/x
y is numpy array vs. dpnp array
Complete reproducer is here https://gist.github.com/samaid/b4510dbcd7285ceed36b42dd96acf30c
Problem in type operator:
In: type(dpnp.float32(1.0))
Out: <class 'numpy.float32'>
In: dpnp.float32(1.0) / x
Out: array([array(1.), array(0.5), array(0.33333333)], dtype=object)
To avoid this problem you can use:
y = np.asarray(1.0, dtype=np.float32) / x
instead of
y = np.float32(1.0) / x