diff --git a/sklearn/utils/_random.pyx b/sklearn/utils/_random.pyx index 3589ffd2fdc4c..9b71b112aa1fb 100644 --- a/sklearn/utils/_random.pyx +++ b/sklearn/utils/_random.pyx @@ -78,7 +78,7 @@ cpdef _sample_without_replacement_with_tracking_selection( cdef cnp.int_t i cdef cnp.int_t j - cdef cnp.int_t[:] out = np.empty((n_samples, ), dtype=int) + cdef cnp.int_t[::1] out = np.empty((n_samples, ), dtype=int) rng = check_random_state(random_state) rng_randint = rng.randint @@ -133,9 +133,9 @@ cpdef _sample_without_replacement_with_pool(cnp.int_t n_population, cdef cnp.int_t i cdef cnp.int_t j - cdef cnp.int_t[:] out = np.empty((n_samples, ), dtype=int) + cdef cnp.int_t[::1] out = np.empty((n_samples, ), dtype=int) - cdef cnp.int_t[:] pool = np.empty((n_population, ), + cdef cnp.int_t[::1] pool = np.empty((n_population, ), dtype=int) rng = check_random_state(random_state) @@ -195,7 +195,7 @@ cpdef _sample_without_replacement_with_reservoir_sampling( cdef cnp.int_t i cdef cnp.int_t j - cdef cnp.int_t[:] out = np.empty((n_samples, ), dtype=int) + cdef cnp.int_t[::1] out = np.empty((n_samples, ), dtype=int) rng = check_random_state(random_state) rng_randint = rng.randint