Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd0d771

Browse filesBrowse files
authored
MAINT Use contiguous memoryviews in _random.pyx (#25871)
1 parent 92e0f3c commit cd0d771
Copy full SHA for cd0d771

File tree

1 file changed

+4
-4
lines changed
Filter options

1 file changed

+4
-4
lines changed

‎sklearn/utils/_random.pyx

Copy file name to clipboardExpand all lines: sklearn/utils/_random.pyx
+4-4Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.