@@ -63,6 +63,12 @@ def test_unique_values_strided():
63
63
uv = dpt .unique_values (inp )
64
64
assert dpt .all (uv == dpt .arange (2 , dtype = "i4" ))
65
65
66
+ inp = dpt .reshape (inp , - 1 )
67
+ inp = dpt .flip (dpt .reshape (inp , - 1 ))
68
+
69
+ uv = dpt .unique_values (inp )
70
+ assert dpt .all (uv == dpt .arange (2 , dtype = "i4" ))
71
+
66
72
67
73
@pytest .mark .parametrize (
68
74
"dtype" ,
@@ -108,6 +114,12 @@ def test_unique_counts_strided():
108
114
assert dpt .all (uv == dpt .arange (2 , dtype = "i4" ))
109
115
assert dpt .all (uv_counts == dpt .full (2 , n / 2 * m , dtype = uv_counts .dtype ))
110
116
117
+ inp = dpt .flip (dpt .reshape (inp , - 1 ))
118
+
119
+ uv , uv_counts = dpt .unique_counts (inp )
120
+ assert dpt .all (uv == dpt .arange (2 , dtype = "i4" ))
121
+ assert dpt .all (uv_counts == dpt .full (2 , n / 2 * m , dtype = uv_counts .dtype ))
122
+
111
123
112
124
@pytest .mark .parametrize (
113
125
"dtype" ,
@@ -155,6 +167,13 @@ def test_unique_inverse_strided():
155
167
assert dpt .all (inp == uv [inv ])
156
168
assert inp .shape == inv .shape
157
169
170
+ inp = dpt .flip (dpt .reshape (inp , - 1 ))
171
+
172
+ uv , inv = dpt .unique_inverse (inp )
173
+ assert dpt .all (uv == dpt .arange (2 , dtype = "i4" ))
174
+ assert dpt .all (inp == uv [inv ])
175
+ assert inp .shape == inv .shape
176
+
158
177
159
178
@pytest .mark .parametrize (
160
179
"dtype" ,
@@ -206,6 +225,15 @@ def test_unique_all_strided():
206
225
assert inp .shape == inv .shape
207
226
assert dpt .all (uv_counts == dpt .full (2 , n / 2 * m , dtype = uv_counts .dtype ))
208
227
228
+ inp = dpt .flip (dpt .reshape (inp , - 1 ))
229
+
230
+ uv , ind , inv , uv_counts = dpt .unique_all (inp )
231
+ assert dpt .all (uv == dpt .arange (2 , dtype = "i4" ))
232
+ assert dpt .all (uv == inp [ind ])
233
+ assert dpt .all (inp == uv [inv ])
234
+ assert inp .shape == inv .shape
235
+ assert dpt .all (uv_counts == dpt .full (2 , n / 2 * m , dtype = uv_counts .dtype ))
236
+
209
237
210
238
def test_set_functions_empty_input ():
211
239
get_queue_or_skip ()
0 commit comments