@@ -349,19 +349,19 @@ def _copy_from_usm_ndarray_to_usm_ndarray(dst, src):
349
349
_copy_same_shape (dst , src_same_shape )
350
350
351
351
352
- def _make_empty_like_orderK (X , dt , usm_type , dev ):
352
+ def _make_empty_like_orderK (x , dt , usm_type , dev ):
353
353
"""
354
- Returns empty array with shape and strides like `X `, with dtype `dt`,
354
+ Returns empty array with shape and strides like `x `, with dtype `dt`,
355
355
USM type `usm_type`, on device `dev`.
356
356
"""
357
- st = list (X .strides )
357
+ st = list (x .strides )
358
358
perm = sorted (
359
- range (X .ndim ),
360
- key = lambda d : builtins .abs (st [d ]) if X .shape [d ] > 1 else 0 ,
359
+ range (x .ndim ),
360
+ key = lambda d : builtins .abs (st [d ]) if x .shape [d ] > 1 else 0 ,
361
361
reverse = True ,
362
362
)
363
- inv_perm = sorted (range (X .ndim ), key = lambda i : perm [i ])
364
- sh = X .shape
363
+ inv_perm = sorted (range (x .ndim ), key = lambda i : perm [i ])
364
+ sh = x .shape
365
365
sh_sorted = tuple (sh [i ] for i in perm )
366
366
R = dpt .empty (sh_sorted , dtype = dt , usm_type = usm_type , device = dev , order = "C" )
367
367
if min (st ) < 0 :
@@ -372,58 +372,58 @@ def _make_empty_like_orderK(X, dt, usm_type, dev):
372
372
if st_sorted [i ] < 0
373
373
else slice (None , None , None )
374
374
)
375
- for i in range (X .ndim )
375
+ for i in range (x .ndim )
376
376
)
377
377
R = R [sl ]
378
378
return dpt .permute_dims (R , inv_perm )
379
379
380
380
381
- def _empty_like_orderK (X , dt , usm_type = None , dev = None ):
381
+ def _empty_like_orderK (x , dt , usm_type = None , dev = None ):
382
382
"""
383
383
Returns empty array like `x`, using order='K'
384
384
385
385
For an array `x` that was obtained by permutation of a contiguous
386
386
array the returned array will have the same shape and the same
387
387
strides as `x`.
388
388
"""
389
- if not isinstance (X , dpt .usm_ndarray ):
390
- raise TypeError (f"Expected usm_ndarray, got { type (X )} " )
389
+ if not isinstance (x , dpt .usm_ndarray ):
390
+ raise TypeError (f"Expected usm_ndarray, got { type (x )} " )
391
391
if usm_type is None :
392
- usm_type = X .usm_type
392
+ usm_type = x .usm_type
393
393
if dev is None :
394
- dev = X .device
395
- fl = X .flags
396
- if fl ["C" ] or X .size <= 1 :
394
+ dev = x .device
395
+ fl = x .flags
396
+ if fl ["C" ] or x .size <= 1 :
397
397
return dpt .empty_like (
398
- X , dtype = dt , usm_type = usm_type , device = dev , order = "C"
398
+ x , dtype = dt , usm_type = usm_type , device = dev , order = "C"
399
399
)
400
400
elif fl ["F" ]:
401
401
return dpt .empty_like (
402
- X , dtype = dt , usm_type = usm_type , device = dev , order = "F"
402
+ x , dtype = dt , usm_type = usm_type , device = dev , order = "F"
403
403
)
404
- return _make_empty_like_orderK (X , dt , usm_type , dev )
404
+ return _make_empty_like_orderK (x , dt , usm_type , dev )
405
405
406
406
407
- def _from_numpy_empty_like_orderK (X , dt , usm_type , dev ):
407
+ def _from_numpy_empty_like_orderK (x , dt , usm_type , dev ):
408
408
"""
409
409
Returns empty usm_ndarray like NumPy array `x`, using order='K'
410
410
411
411
For an array `x` that was obtained by permutation of a contiguous
412
412
array the returned array will have the same shape and the same
413
413
strides as `x`.
414
414
"""
415
- if not isinstance (X , np .ndarray ):
416
- raise TypeError (f"Expected numpy.ndarray, got { type (X )} " )
417
- fl = X .flags
418
- if fl ["C" ] or X .size <= 1 :
415
+ if not isinstance (x , np .ndarray ):
416
+ raise TypeError (f"Expected numpy.ndarray, got { type (x )} " )
417
+ fl = x .flags
418
+ if fl ["C" ] or x .size <= 1 :
419
419
return dpt .empty (
420
- X .shape , dtype = dt , usm_type = usm_type , device = dev , order = "C"
420
+ x .shape , dtype = dt , usm_type = usm_type , device = dev , order = "C"
421
421
)
422
422
elif fl ["F" ]:
423
423
return dpt .empty (
424
- X .shape , dtype = dt , usm_type = usm_type , device = dev , order = "F"
424
+ x .shape , dtype = dt , usm_type = usm_type , device = dev , order = "F"
425
425
)
426
- return _make_empty_like_orderK (X , dt , usm_type , dev )
426
+ return _make_empty_like_orderK (x , dt , usm_type , dev )
427
427
428
428
429
429
def _empty_like_pair_orderK (X1 , X2 , dt , res_shape , usm_type , dev ):
@@ -763,7 +763,7 @@ def _extract_impl(ary, ary_mask, axis=0):
763
763
if exec_q is None :
764
764
raise dpctl .utils .ExecutionPlacementError (
765
765
"arrays have different associated queues. "
766
- "Use `Y .to_device(X .device)` to migrate."
766
+ "Use `y .to_device(x .device)` to migrate."
767
767
)
768
768
ary_nd = ary .ndim
769
769
pp = normalize_axis_index (operator .index (axis ), ary_nd )
0 commit comments