Replace dmlc any with std any. (#8892)

This commit is contained in:
Jiaming Yuan
2023-03-11 06:11:04 +08:00
committed by GitHub
parent 79efcd37f5
commit 36a7396658
8 changed files with 64 additions and 81 deletions

View File

@@ -1,9 +1,9 @@
/**
* Copyright 2017-2023 by XGBoost Contributors
*/
#include <dmlc/any.h>
#include <dmlc/omp.h>
#include <any> // for any, any_cast
#include <cstddef>
#include <limits>
#include <mutex>
@@ -637,12 +637,12 @@ class CPUPredictor : public Predictor {
}
template <typename Adapter, size_t kBlockSize>
void DispatchedInplacePredict(dmlc::any const &x, std::shared_ptr<DMatrix> p_m,
void DispatchedInplacePredict(std::any const &x, std::shared_ptr<DMatrix> p_m,
const gbm::GBTreeModel &model, float missing,
PredictionCacheEntry *out_preds,
uint32_t tree_begin, uint32_t tree_end) const {
PredictionCacheEntry *out_preds, uint32_t tree_begin,
uint32_t tree_end) const {
auto const n_threads = this->ctx_->Threads();
auto m = dmlc::get<std::shared_ptr<Adapter>>(x);
auto m = std::any_cast<std::shared_ptr<Adapter>>(x);
CHECK_EQ(m->NumColumns(), model.learner_model_param->num_feature)
<< "Number of columns in data must equal to trained model.";
if (p_m) {