@@ -85,14 +85,14 @@ def test_usm_ndarray_flags():
85
85
"c8" ,
86
86
"c16" ,
87
87
b"float32" ,
88
- np .dtype ("d" ),
88
+ dpt .dtype ("d" ),
89
89
np .half ,
90
90
],
91
91
)
92
92
def test_dtypes (dtype ):
93
93
Xusm = dpt .usm_ndarray ((1 ,), dtype = dtype )
94
- assert Xusm .itemsize == np .dtype (dtype ).itemsize
95
- expected_fmt = (np .dtype (dtype ).str )[1 :]
94
+ assert Xusm .itemsize == dpt .dtype (dtype ).itemsize
95
+ expected_fmt = (dpt .dtype (dtype ).str )[1 :]
96
96
actual_fmt = Xusm .__sycl_usm_array_interface__ ["typestr" ][1 :]
97
97
assert expected_fmt == actual_fmt
98
98
@@ -112,7 +112,7 @@ def test_properties(dt):
112
112
assert isinstance (X .sycl_queue , dpctl .SyclQueue )
113
113
assert isinstance (X .sycl_device , dpctl .SyclDevice )
114
114
assert isinstance (X .sycl_context , dpctl .SyclContext )
115
- assert isinstance (X .dtype , np .dtype )
115
+ assert isinstance (X .dtype , dpt .dtype )
116
116
assert isinstance (X .__sycl_usm_array_interface__ , dict )
117
117
assert isinstance (X .mT , dpt .usm_ndarray )
118
118
assert isinstance (X .imag , dpt .usm_ndarray )
@@ -521,44 +521,44 @@ def test_pyx_capi_check_constants():
521
521
assert w_flag > 0 and 0 == (w_flag & (w_flag - 1 ))
522
522
523
523
bool_typenum = _pyx_capi_int (X , "UAR_BOOL" )
524
- assert bool_typenum == np .dtype ("bool_" ).num
524
+ assert bool_typenum == dpt .dtype ("bool_" ).num
525
525
526
526
byte_typenum = _pyx_capi_int (X , "UAR_BYTE" )
527
- assert byte_typenum == np .dtype (np .byte ).num
527
+ assert byte_typenum == dpt .dtype (np .byte ).num
528
528
ubyte_typenum = _pyx_capi_int (X , "UAR_UBYTE" )
529
- assert ubyte_typenum == np .dtype (np .ubyte ).num
529
+ assert ubyte_typenum == dpt .dtype (np .ubyte ).num
530
530
531
531
short_typenum = _pyx_capi_int (X , "UAR_SHORT" )
532
- assert short_typenum == np .dtype (np .short ).num
532
+ assert short_typenum == dpt .dtype (np .short ).num
533
533
ushort_typenum = _pyx_capi_int (X , "UAR_USHORT" )
534
- assert ushort_typenum == np .dtype (np .ushort ).num
534
+ assert ushort_typenum == dpt .dtype (np .ushort ).num
535
535
536
536
int_typenum = _pyx_capi_int (X , "UAR_INT" )
537
- assert int_typenum == np .dtype (np .intc ).num
537
+ assert int_typenum == dpt .dtype (np .intc ).num
538
538
uint_typenum = _pyx_capi_int (X , "UAR_UINT" )
539
- assert uint_typenum == np .dtype (np .uintc ).num
539
+ assert uint_typenum == dpt .dtype (np .uintc ).num
540
540
541
541
long_typenum = _pyx_capi_int (X , "UAR_LONG" )
542
- assert long_typenum == np .dtype (np .int_ ).num
542
+ assert long_typenum == dpt .dtype (np .int_ ).num
543
543
ulong_typenum = _pyx_capi_int (X , "UAR_ULONG" )
544
- assert ulong_typenum == np .dtype (np .uint ).num
544
+ assert ulong_typenum == dpt .dtype (np .uint ).num
545
545
546
546
longlong_typenum = _pyx_capi_int (X , "UAR_LONGLONG" )
547
- assert longlong_typenum == np .dtype (np .longlong ).num
547
+ assert longlong_typenum == dpt .dtype (np .longlong ).num
548
548
ulonglong_typenum = _pyx_capi_int (X , "UAR_ULONGLONG" )
549
- assert ulonglong_typenum == np .dtype (np .ulonglong ).num
549
+ assert ulonglong_typenum == dpt .dtype (np .ulonglong ).num
550
550
551
551
half_typenum = _pyx_capi_int (X , "UAR_HALF" )
552
- assert half_typenum == np .dtype (np .half ).num
552
+ assert half_typenum == dpt .dtype (np .half ).num
553
553
float_typenum = _pyx_capi_int (X , "UAR_FLOAT" )
554
- assert float_typenum == np .dtype (np .single ).num
554
+ assert float_typenum == dpt .dtype (np .single ).num
555
555
double_typenum = _pyx_capi_int (X , "UAR_DOUBLE" )
556
- assert double_typenum == np .dtype (np .double ).num
556
+ assert double_typenum == dpt .dtype (np .double ).num
557
557
558
558
cfloat_typenum = _pyx_capi_int (X , "UAR_CFLOAT" )
559
- assert cfloat_typenum == np .dtype (np .csingle ).num
559
+ assert cfloat_typenum == dpt .dtype (np .csingle ).num
560
560
cdouble_typenum = _pyx_capi_int (X , "UAR_CDOUBLE" )
561
- assert cdouble_typenum == np .dtype (np .cdouble ).num
561
+ assert cdouble_typenum == dpt .dtype (np .cdouble ).num
562
562
563
563
564
564
_all_dtypes = [
@@ -720,12 +720,12 @@ def test_setitem_wingaps():
720
720
q = dpctl .SyclQueue ()
721
721
except dpctl .SyclQueueCreationError :
722
722
pytest .skip ("Default queue could not be created" )
723
- if np .dtype ("intc" ).itemsize == np .dtype ("int32" ).itemsize :
723
+ if dpt .dtype ("intc" ).itemsize == dpt .dtype ("int32" ).itemsize :
724
724
dpt_dst = dpt .empty (4 , dtype = "int32" , sycl_queue = q )
725
725
np_src = np .arange (4 , dtype = "intc" )
726
726
dpt_dst [:] = np_src # should not raise exceptions
727
727
assert np .array_equal (dpt .asnumpy (dpt_dst ), np_src )
728
- if np .dtype ("long" ).itemsize == np .dtype ("longlong" ).itemsize :
728
+ if dpt .dtype ("long" ).itemsize == dpt .dtype ("longlong" ).itemsize :
729
729
dpt_dst = dpt .empty (4 , dtype = "longlong" , sycl_queue = q )
730
730
np_src = np .arange (4 , dtype = "long" )
731
731
dpt_dst [:] = np_src # should not raise exceptions
@@ -1027,7 +1027,7 @@ def test_full(dtype):
1027
1027
1028
1028
def test_full_dtype_inference ():
1029
1029
assert np .issubdtype (dpt .full (10 , 4 ).dtype , np .integer )
1030
- assert dpt .full (10 , True ).dtype is np .dtype (np .bool_ )
1030
+ assert dpt .full (10 , True ).dtype is dpt .dtype (np .bool_ )
1031
1031
assert np .issubdtype (dpt .full (10 , 12.3 ).dtype , np .floating )
1032
1032
assert np .issubdtype (dpt .full (10 , 0.3 - 2j ).dtype , np .complexfloating )
1033
1033
@@ -1047,7 +1047,7 @@ def test_arange(dt):
1047
1047
"Device does not support double precision floating point type"
1048
1048
)
1049
1049
X = dpt .arange (0 , 123 , dtype = dt , sycl_queue = q )
1050
- dt = np .dtype (dt )
1050
+ dt = dpt .dtype (dt )
1051
1051
if np .issubdtype (dt , np .integer ):
1052
1052
assert int (X [47 ]) == 47
1053
1053
elif np .issubdtype (dt , np .floating ):
@@ -1056,7 +1056,7 @@ def test_arange(dt):
1056
1056
assert complex (X [47 ]) == 47.0 + 0.0j
1057
1057
1058
1058
# choose size larger than maximal value that u1/u2 can accomodate
1059
- sz = int (np .iinfo (np .int16 ).max ) + 1
1059
+ sz = int (dpt .iinfo (dpt .int16 ).max ) + 1
1060
1060
X1 = dpt .arange (sz , dtype = dt , sycl_queue = q )
1061
1061
assert X1 .shape == (sz ,)
1062
1062
@@ -1101,9 +1101,9 @@ def test_linspace_fp():
1101
1101
n = 16
1102
1102
X = dpt .linspace (0 , n - 1 , num = n , sycl_queue = q )
1103
1103
if q .sycl_device .has_aspect_fp64 :
1104
- assert X .dtype == np .dtype ("float64" )
1104
+ assert X .dtype == dpt .dtype ("float64" )
1105
1105
else :
1106
- assert X .dtype == np .dtype ("float32" )
1106
+ assert X .dtype == dpt .dtype ("float32" )
1107
1107
assert X .shape == (n ,)
1108
1108
assert X .strides == (1 ,)
1109
1109
@@ -1238,7 +1238,7 @@ def test_full_like(dt, usm_kind):
1238
1238
"Device does not support double precision floating point type"
1239
1239
)
1240
1240
1241
- fill_v = np .dtype (dt ).type (1 )
1241
+ fill_v = dpt .dtype (dt ).type (1 )
1242
1242
X = dpt .empty ((4 , 5 ), dtype = dt , usm_type = usm_kind , sycl_queue = q )
1243
1243
Y = dpt .full_like (X , fill_v )
1244
1244
assert X .shape == Y .shape
0 commit comments