@@ -298,25 +298,25 @@ def _clip_none(x, val, out, order, _binary_fn):
298
298
else :
299
299
val_ary = dpt .asarray (val , dtype = val_dtype , sycl_queue = exec_q )
300
300
301
+ if order == "A" :
302
+ order = (
303
+ "F"
304
+ if all (
305
+ arr .flags .f_contiguous
306
+ for arr in (
307
+ x ,
308
+ val_ary ,
309
+ )
310
+ )
311
+ else "C"
312
+ )
301
313
if val_dtype == res_dt :
302
314
if out is None :
303
315
if order == "K" :
304
316
out = _empty_like_pair_orderK (
305
317
x , val_ary , res_dt , res_shape , res_usm_type , exec_q
306
318
)
307
319
else :
308
- if order == "A" :
309
- order = (
310
- "F"
311
- if all (
312
- arr .flags .f_contiguous
313
- for arr in (
314
- x ,
315
- val_ary ,
316
- )
317
- )
318
- else "C"
319
- )
320
320
out = dpt .empty (
321
321
res_shape ,
322
322
dtype = res_dt ,
@@ -347,8 +347,6 @@ def _clip_none(x, val, out, order, _binary_fn):
347
347
if order == "K" :
348
348
buf = _empty_like_orderK (val_ary , res_dt )
349
349
else :
350
- if order == "A" :
351
- order = "F" if x .flags .f_contiguous else "C"
352
350
buf = dpt .empty_like (val_ary , dtype = res_dt , order = order )
353
351
ht_copy_ev , copy_ev = ti ._copy_usm_ndarray_into_usm_ndarray (
354
352
src = val_ary , dst = buf , sycl_queue = exec_q
@@ -473,8 +471,6 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
473
471
if order == "K" :
474
472
out = _empty_like_orderK (x , x .dtype )
475
473
else :
476
- if order == "A" :
477
- order = "F" if x .flags .f_contiguous else "C"
478
474
out = dpt .empty_like (x , order = order )
479
475
480
476
ht_copy_ev , copy_ev = ti ._copy_usm_ndarray_into_usm_ndarray (
@@ -659,6 +655,19 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
659
655
else :
660
656
a_max = dpt .asarray (max , dtype = max_dtype , sycl_queue = exec_q )
661
657
658
+ if order == "A" :
659
+ order = (
660
+ "F"
661
+ if all (
662
+ arr .flags .f_contiguous
663
+ for arr in (
664
+ x ,
665
+ a_min ,
666
+ a_max ,
667
+ )
668
+ )
669
+ else "C"
670
+ )
662
671
if buf1_dt is None and buf2_dt is None :
663
672
if out is None :
664
673
if order == "K" :
@@ -672,19 +681,6 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
672
681
exec_q ,
673
682
)
674
683
else :
675
- if order == "A" :
676
- order = (
677
- "F"
678
- if all (
679
- arr .flags .f_contiguous
680
- for arr in (
681
- x ,
682
- a_min ,
683
- a_max ,
684
- )
685
- )
686
- else "C"
687
- )
688
684
out = dpt .empty (
689
685
res_shape ,
690
686
dtype = res_dt ,
@@ -718,18 +714,6 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
718
714
if order == "K" :
719
715
buf2 = _empty_like_orderK (a_max , buf2_dt )
720
716
else :
721
- if order == "A" :
722
- order = (
723
- "F"
724
- if all (
725
- arr .flags .f_contiguous
726
- for arr in (
727
- x ,
728
- a_min ,
729
- )
730
- )
731
- else "C"
732
- )
733
717
buf2 = dpt .empty_like (a_max , dtype = buf2_dt , order = order )
734
718
ht_copy_ev , copy_ev = ti ._copy_usm_ndarray_into_usm_ndarray (
735
719
src = a_max , dst = buf2 , sycl_queue = exec_q
@@ -784,18 +768,6 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
784
768
if order == "K" :
785
769
buf1 = _empty_like_orderK (a_min , buf1_dt )
786
770
else :
787
- if order == "A" :
788
- order = (
789
- "F"
790
- if all (
791
- arr .flags .f_contiguous
792
- for arr in (
793
- x ,
794
- a_max ,
795
- )
796
- )
797
- else "C"
798
- )
799
771
buf1 = dpt .empty_like (a_min , dtype = buf1_dt , order = order )
800
772
ht_copy_ev , copy_ev = ti ._copy_usm_ndarray_into_usm_ndarray (
801
773
src = a_min , dst = buf1 , sycl_queue = exec_q
@@ -846,7 +818,7 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
846
818
ht_binary_ev .wait ()
847
819
return out
848
820
849
- if order in [ "K" , "A" ] :
821
+ if order == "K" :
850
822
if (
851
823
x .flags .f_contiguous
852
824
and a_min .flags .f_contiguous
@@ -859,8 +831,6 @@ def clip(x, /, min=None, max=None, out=None, order="K"):
859
831
and a_max .flags .c_contiguous
860
832
):
861
833
order = "C"
862
- else :
863
- order = "C" if order == "A" else "K"
864
834
if order == "K" :
865
835
buf1 = _empty_like_orderK (a_min , buf1_dt )
866
836
else :
0 commit comments