@@ -517,7 +517,11 @@ def copy(usm_ary, order="K"):
517517 - "K": match the layout of `usm_ary` as closely as possible.
518518
519519 """
520- order = order .upper ()
520+ if len (order ) == 0 or order [0 ] not in "KkAaCcFf" :
521+ raise ValueError (
522+ "Unrecognized order keyword value, expecting 'K', 'A', 'F', or 'C'."
523+ )
524+ order = order [0 ].upper ()
521525 if not isinstance (usm_ary , dpt .usm_ndarray ):
522526 return TypeError (
523527 f"Expected object of type dpt.usm_ndarray, got { type (usm_ary )} "
@@ -582,16 +586,15 @@ def astype(usm_ary, newdtype, order="K", casting="unsafe", copy=True):
582586
583587 A view can be returned, if possible, when `copy=False` is used.
584588 """
585- order = order .upper ()
586589 if not isinstance (usm_ary , dpt .usm_ndarray ):
587590 return TypeError (
588591 f"Expected object of type dpt.usm_ndarray, got { type (usm_ary )} "
589592 )
590- if not isinstance (order , str ) or order not in [ "A" , "C" , "F" , "K" ] :
593+ if len (order ) == 0 or order [ 0 ] not in "KkAaCcFf" :
591594 raise ValueError (
592- "Unrecognized value of the order keyword. "
593- "Recognized values are 'A', 'C', 'F', or 'K'"
595+ "Unrecognized order keyword value, expecting 'K', 'A', 'F', or 'C'."
594596 )
597+ order = order [0 ].upper ()
595598 ary_dtype = usm_ary .dtype
596599 target_dtype = _get_dtype (newdtype , usm_ary .sycl_queue )
597600 if not dpt .can_cast (ary_dtype , target_dtype , casting = casting ):
0 commit comments