Make sure input numpy array is aligned. (#8690)
- use `np.require` to specify that the alignment is required. - scipy csr as well. - validate input pointer in `ArrayInterface`.
This commit is contained in:
@@ -327,7 +327,7 @@ class TestDMatrix:
|
||||
nrow = 100
|
||||
ncol = 1000
|
||||
x = rand(nrow, ncol, density=0.0005, format='csr', random_state=rng)
|
||||
assert x.indices.max() < ncol - 1
|
||||
assert x.indices.max() < ncol
|
||||
x.data[:] = 1
|
||||
dtrain = xgb.DMatrix(x, label=rng.binomial(1, 0.3, nrow))
|
||||
assert (dtrain.num_row(), dtrain.num_col()) == (nrow, ncol)
|
||||
|
||||
Reference in New Issue
Block a user