@@ -62,7 +62,7 @@ def test_array_from_numpy_broad_cast(self, xp, dtype, order):
62
62
@testing .for_orders ("CFAK" , name = "src_order" )
63
63
@testing .for_orders ("CFAK" , name = "dst_order" )
64
64
@testing .for_all_dtypes ()
65
- @testing .numpy_cupy_array_equal ()
65
+ @testing .numpy_cupy_array_equal (strides_check = True )
66
66
def test_array_from_list_of_numpy (self , xp , dtype , src_order , dst_order ):
67
67
# compares numpy.array(<list of numpy.ndarray>) with
68
68
# cupy.array(<list of numpy.ndarray>)
@@ -75,7 +75,7 @@ def test_array_from_list_of_numpy(self, xp, dtype, src_order, dst_order):
75
75
@testing .for_orders ("CFAK" , name = "src_order" )
76
76
@testing .for_orders ("CFAK" , name = "dst_order" )
77
77
@testing .for_all_dtypes ()
78
- @testing .numpy_cupy_array_equal ()
78
+ @testing .numpy_cupy_array_equal (strides_check = True )
79
79
def test_array_from_list_of_numpy_view (
80
80
self , xp , dtype , src_order , dst_order
81
81
):
@@ -93,7 +93,7 @@ def test_array_from_list_of_numpy_view(
93
93
94
94
@testing .for_orders ("CFAK" )
95
95
@testing .for_all_dtypes ()
96
- @testing .numpy_cupy_array_equal ()
96
+ @testing .numpy_cupy_array_equal (strides_check = True )
97
97
def test_array_from_list_of_numpy_scalar (self , xp , dtype , order ):
98
98
# compares numpy.array(<list of numpy.ndarray>) with
99
99
# cupy.array(<list of numpy.ndarray>)
@@ -103,7 +103,7 @@ def test_array_from_list_of_numpy_scalar(self, xp, dtype, order):
103
103
@testing .for_orders ("CFAK" , name = "src_order" )
104
104
@testing .for_orders ("CFAK" , name = "dst_order" )
105
105
@testing .for_all_dtypes ()
106
- @testing .numpy_cupy_array_equal ()
106
+ @testing .numpy_cupy_array_equal (strides_check = True )
107
107
def test_array_from_nested_list_of_numpy (
108
108
self , xp , dtype , src_order , dst_order
109
109
):
@@ -118,7 +118,9 @@ def test_array_from_nested_list_of_numpy(
118
118
@testing .for_orders ("CFAK" , name = "src_order" )
119
119
@testing .for_orders ("CFAK" , name = "dst_order" )
120
120
@testing .for_all_dtypes_combination (names = ("dtype1" , "dtype2" ))
121
- @testing .numpy_cupy_array_equal (type_check = has_support_aspect64 ())
121
+ @testing .numpy_cupy_array_equal (
122
+ type_check = has_support_aspect64 (), strides_check = True
123
+ )
122
124
def test_array_from_list_of_cupy (
123
125
self , xp , dtype1 , dtype2 , src_order , dst_order
124
126
):
@@ -133,7 +135,7 @@ def test_array_from_list_of_cupy(
133
135
@testing .for_orders ("CFAK" , name = "src_order" )
134
136
@testing .for_orders ("CFAK" , name = "dst_order" )
135
137
@testing .for_all_dtypes ()
136
- @testing .numpy_cupy_array_equal ()
138
+ @testing .numpy_cupy_array_equal (strides_check = True )
137
139
def test_array_from_list_of_cupy_view (
138
140
self , xp , dtype , src_order , dst_order
139
141
):
@@ -152,7 +154,7 @@ def test_array_from_list_of_cupy_view(
152
154
@testing .for_orders ("CFAK" , name = "src_order" )
153
155
@testing .for_orders ("CFAK" , name = "dst_order" )
154
156
@testing .for_all_dtypes ()
155
- @testing .numpy_cupy_array_equal ()
157
+ @testing .numpy_cupy_array_equal (strides_check = True )
156
158
def test_array_from_nested_list_of_cupy (
157
159
self , xp , dtype , src_order , dst_order
158
160
):
@@ -166,7 +168,7 @@ def test_array_from_nested_list_of_cupy(
166
168
167
169
@testing .for_orders ("CFAK" )
168
170
@testing .for_all_dtypes ()
169
- @testing .numpy_cupy_array_equal ()
171
+ @testing .numpy_cupy_array_equal (strides_check = True )
170
172
def test_array_from_list_of_cupy_scalar (self , xp , dtype , order ):
171
173
# compares numpy.array(<list of numpy.ndarray>) with
172
174
# cupy.array(<list of cupy.ndarray>)
@@ -240,7 +242,7 @@ def test_array_copy_with_dtype_being_none(self, xp, order):
240
242
@testing .for_orders ("CFAK" , name = "dst_order" )
241
243
@testing .for_all_dtypes (name = "dtype1" , no_complex = True )
242
244
@testing .for_all_dtypes (name = "dtype2" )
243
- @testing .numpy_cupy_array_equal ()
245
+ @testing .numpy_cupy_array_equal (strides_check = True )
244
246
def test_array_copy_list_of_numpy_with_dtype (
245
247
self , xp , dtype1 , dtype2 , src_order , dst_order
246
248
):
@@ -256,7 +258,7 @@ def test_array_copy_list_of_numpy_with_dtype(
256
258
@testing .for_orders ("CFAK" , name = "dst_order" )
257
259
@testing .for_all_dtypes (name = "dtype1" , no_complex = True )
258
260
@testing .for_all_dtypes (name = "dtype2" )
259
- @testing .numpy_cupy_array_equal ()
261
+ @testing .numpy_cupy_array_equal (strides_check = True )
260
262
def test_array_copy_list_of_numpy_with_dtype_char (
261
263
self , xp , dtype1 , dtype2 , src_order , dst_order
262
264
):
@@ -272,7 +274,7 @@ def test_array_copy_list_of_numpy_with_dtype_char(
272
274
@testing .for_orders ("CFAK" , name = "dst_order" )
273
275
@testing .for_all_dtypes (name = "dtype1" , no_complex = True )
274
276
@testing .for_all_dtypes (name = "dtype2" )
275
- @testing .numpy_cupy_array_equal ()
277
+ @testing .numpy_cupy_array_equal (strides_check = True )
276
278
def test_array_copy_list_of_cupy_with_dtype (
277
279
self , xp , dtype1 , dtype2 , src_order , dst_order
278
280
):
@@ -288,7 +290,7 @@ def test_array_copy_list_of_cupy_with_dtype(
288
290
@testing .for_orders ("CFAK" , name = "dst_order" )
289
291
@testing .for_all_dtypes (name = "dtype1" , no_complex = True )
290
292
@testing .for_all_dtypes (name = "dtype2" )
291
- @testing .numpy_cupy_array_equal ()
293
+ @testing .numpy_cupy_array_equal (strides_check = True )
292
294
def test_array_copy_list_of_cupy_with_dtype_char (
293
295
self , xp , dtype1 , dtype2 , src_order , dst_order
294
296
):
@@ -656,7 +658,7 @@ def test_with_strides(self, dtype):
656
658
DummyObjectWithCudaArrayInterface (a , self .ver , self .strides )
657
659
)
658
660
assert a .strides == b .strides
659
- assert a .nbytes == b .nbytes
661
+ assert a .nbytes == b .data . mem . size
660
662
661
663
@testing .for_all_dtypes ()
662
664
def test_with_zero_size_array (self , dtype ):
@@ -665,7 +667,8 @@ def test_with_zero_size_array(self, dtype):
665
667
DummyObjectWithCudaArrayInterface (a , self .ver , self .strides )
666
668
)
667
669
assert a .strides == b .strides
668
- assert a .nbytes == b .nbytes
670
+ assert a .nbytes == b .data .mem .size
671
+ assert a .data .ptr == 0
669
672
assert a .size == 0
670
673
671
674
@testing .for_all_dtypes ()
@@ -724,7 +727,7 @@ def test_with_over_size_array(self):
724
727
testing .assert_array_equal (a , b )
725
728
726
729
727
- class DummyObjectWithCudaArrayInterface ( object ) :
730
+ class DummyObjectWithCudaArrayInterface :
728
731
def __init__ (self , a , ver , include_strides = False , mask = None , stream = None ):
729
732
assert ver in tuple (range (max_cuda_array_interface_version + 1 ))
730
733
self .a = None
@@ -834,7 +837,7 @@ def test_cupy_array(self, dtype):
834
837
is_copied = not (
835
838
(actual is a )
836
839
or (self .xp is cupy )
837
- and (a .get_array (). _pointer == actual .get_array (). _pointer )
840
+ and (a .data . ptr == actual .data . ptr )
838
841
)
839
842
assert should_copy == is_copied
840
843
0 commit comments