diff --git a/src/data/simple_csr_source.cc b/src/data/simple_csr_source.cc index db23bb9d7..78f14f360 100644 --- a/src/data/simple_csr_source.cc +++ b/src/data/simple_csr_source.cc @@ -41,7 +41,6 @@ void SimpleCSRSource::CopyFrom(dmlc::Parser* parser) { if (batch.weight != nullptr) { info.weights.insert(info.weights.end(), batch.weight, batch.weight + batch.size); } - row_data_.reserve(row_data_.size() + batch.offset[batch.size] - batch.offset[0]); CHECK(batch.index != nullptr); // update information this->info.num_row += batch.size; @@ -54,9 +53,8 @@ void SimpleCSRSource::CopyFrom(dmlc::Parser* parser) { static_cast(index + 1)); } size_t top = row_ptr_.size(); - row_ptr_.resize(top + batch.size); for (size_t i = 0; i < batch.size; ++i) { - row_ptr_[top + i] = row_ptr_[top - 1] + batch.offset[i + 1] - batch.offset[0]; + row_ptr_.push_back(row_ptr_[top - 1] + batch.offset[i + 1] - batch.offset[0]); } } this->info.num_nonzero = static_cast(row_data_.size());