-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
The values of order
argument is not validating when strides
keyword is passed:
import dpctl, dpctl.tensor as dpt
dpctl.__version__
# Out: '0.18.0dev0+77.g26d34f565d'
# `order` does not pass a validation check:
dpt.usm_ndarray((2, 3), numpy.float32, order='!')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[7], line 1
----> 1 dpt.usm_ndarray((2, 3), numpy.float32, order='!')
File dpctl/tensor/_usmarray.pyx:264, in dpctl.tensor._usmarray.usm_ndarray.__cinit__()
ValueError: Unsupported order='!' given. Supported values are 'C' or 'F'.
# no validation error for `order` when `strides` keyword used:
dpt.usm_ndarray((2, 3), numpy.float32, strides=(2, 1), order='!')
# Out:
# usm_ndarray([[0., 0., 0.],
# [0., 0., 0.]], dtype=float32)
# while numpy validates the order values:
numpy.ndarray((2, 3), numpy.float32, strides=(2, 1), order='!')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[10], line 1
----> 1 numpy.ndarray((2, 3), numpy.float32, strides=(2, 1), order='!')
ValueError: order must be one of 'C', 'F', 'A', or 'K' (got '!')
I guess it might be because the order value isn't used by the constructor of usm_ndarray
in that case.
But I guess it would be good to have the validation check for order
anyway.
ndgrigorian
Metadata
Metadata
Assignees
Labels
No labels