-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
There is a suspicious behavior I faced on Windows (LNL with fp64 support for GPU):
import dpctl, dpctl.tensor as dpt, numpy as np
dpctl.__version__
# Out: '0.22.0dev0+117.g7960513f68'
# for integer input the result is expected
a = dpt.asarray([160, 120])
dpt.astype(a, dpt.uint8)
# Out: usm_ndarray([160, 120], dtype=uint8)
# for float32 the result seems incorrect:
a = dpt.asarray([160., 120.], dtype='f4')
dpt.astype(a, dpt.uint8)
# Out: usm_ndarray([127, 120], dtype=uint8)
# but with float64 works as expected:
a = dpt.asarray([160., 120.], dtype='f8')
dpt.astype(a, dpt.uint8)
# Out: usm_ndarray([160, 120], dtype=uint8)
# NumPy returns the same result in both cases:
a = np.asarray([160, 120])
np.astype(a, dpt.uint8)
# Out: array([160, 120], dtype=uint8)
a = np.asarray([160., 120.], dtype='f4')
np.astype(a, dpt.uint8)
# Out: array([160, 120], dtype=uint8)
# for CPU device the result is the same as for NumPy:
a = dpt.asarray([160., 120.], dtype='i4', device='cpu')
dpt.astype(a, dpt.uint8)
# Out: usm_ndarray([160, 120], dtype=uint8)
I wonder if there is any limitation for float32 dtype or an issue.
Metadata
Metadata
Assignees
Labels
No labels