| 424 | } |
| 425 | |
| 426 | auto MakeQDMForTest(Context const *ctx, bst_idx_t n_samples, bst_feature_t n_features, |
| 427 | Json dconfig) { |
| 428 | bst_bin_t n_bins{16}; |
| 429 | dconfig["max_bin"] = Integer{n_bins}; |
| 430 | |
| 431 | std::size_t n_batches{4}; |
| 432 | std::unique_ptr<ArrayIterForTest> iter_0; |
| 433 | if (ctx->IsCUDA()) { |
| 434 | iter_0 = std::make_unique<CudaArrayIterForTest>(0.0f, n_samples, n_features, n_batches); |
| 435 | } else { |
| 436 | iter_0 = std::make_unique<NumpyArrayIterForTest>(0.0f, n_samples, n_features, n_batches); |
| 437 | } |
| 438 | std::string s_dconfig; |
| 439 | Json::Dump(dconfig, &s_dconfig); |
| 440 | DMatrixHandle p_fmat; |
| 441 | CHECK_EQ(XGQuantileDMatrixCreateFromCallback(static_cast<DataIterHandle>(iter_0.get()), |
| 442 | iter_0->Proxy(), nullptr, Reset, Next, |
| 443 | s_dconfig.c_str(), &p_fmat), |
| 444 | 0); |
| 445 | |
| 446 | std::unique_ptr<ArrayIterForTest> iter_1; |
| 447 | if (ctx->IsCUDA()) { |
| 448 | iter_1 = std::make_unique<CudaArrayIterForTest>(0.0f, n_samples, n_features, n_batches); |
| 449 | } else { |
| 450 | iter_1 = std::make_unique<NumpyArrayIterForTest>(0.0f, n_samples, n_features, n_batches); |
| 451 | } |
| 452 | auto Xy = |
| 453 | std::make_shared<data::IterativeDMatrix>(iter_1.get(), iter_1->Proxy(), nullptr, Reset, Next, |
| 454 | std::numeric_limits<float>::quiet_NaN(), 0, n_bins); |
| 455 | return std::pair{p_fmat, Xy}; |
| 456 | } |
| 457 | |
| 458 | auto MakeExtMemForTest(bst_idx_t n_samples, bst_feature_t n_features, Json dconfig) { |
| 459 | std::size_t n_batches{4}; |
no test coverage detected