8000 MAINT Use contiguous memoryviews in _random.pyx (#25871) · Veghit/scikit-learn@cd0d771 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd0d771

Browse files
authored
MAINT Use contiguous memoryviews in _random.pyx (scikit-learn#25871)
1 parent 92e0f3c commit cd0d771

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/utils/_random.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ cpdef _sample_without_replacement_with_tracking_selection(
7878
7979
cdef cnp.int_t i
8080
cdef cnp.int_t j
81-
cdef cnp.int_t[:] out = np.empty((n_samples, ), dtype=int)
81+
cdef cnp.int_t[::1] out = np.empty((n_samples, ), dtype=int)
8282
8383
rng = check_random_state(random_state)
8484
rng_randint = rng.randint
@@ -133,9 +133,9 @@ cpdef _sample_without_replacement_with_pool(cnp.int_t n_population,
133133
134134
cdef cnp.int_t i
135135
cdef cnp.int_t j
136-
cdef cnp.int_t[:] out = np.empty((n_samples, ), dtype=int)
136+
cdef cnp.int_t[::1] out = np.empty((n_samples, ), dtype=int)
137137
138-
cdef cnp.int_t[:] pool = np.empty((n_population, ),
138+
cdef cnp.int_t[::1] pool = np.empty((n_population, ),
139139
dtype=int)
140140
141141
rng = check_random_state(random_state)
@@ -195,7 +195,7 @@ cpdef _sample_without_replacement_with_reservoir_sampling(
195195
196196
cdef cnp.int_t i
197197
cdef cnp.int_t j
198-
cdef cnp.int_t[:] out = np.empty((n_samples, ), dtype=int)
198+
cdef cnp.int_t[::1] out = np.empty((n_samples, ), dtype=int)
199199
200200
rng = check_random_state(random_state)
201201
rng_randint = rng.randint

0 commit comments

Comments
 (0)
0