Use view for SparsePage exclusively. (#6590)

This commit is contained in:
Jiaming Yuan
2021-01-11 18:04:55 +08:00
committed by GitHub
parent 78f2cd83d7
commit f2f7dd87b8
23 changed files with 151 additions and 113 deletions

View File

@@ -176,9 +176,10 @@ inline void ValidateCuts(const HistogramCuts& cuts, DMatrix* dmat,
// Collect data into columns
std::vector<std::vector<float>> columns(dmat->Info().num_col_);
for (auto& batch : dmat->GetBatches<SparsePage>()) {
auto page = batch.GetView();
ASSERT_GT(batch.Size(), 0ul);
for (auto i = 0ull; i < batch.Size(); i++) {
for (auto e : batch[i]) {
for (auto e : page[i]) {
columns[e.index].push_back(e.fvalue);
}
}