Limit tree depth for GPU hist. (#6045)

This commit is contained in:
Jiaming Yuan
2020-08-22 19:34:52 +08:00
committed by GitHub
parent b9ebbffc57
commit a144daf034
4 changed files with 19 additions and 3 deletions

View File

@@ -505,5 +505,17 @@ TEST(GpuHist, ConfigIO) {
ASSERT_EQ(j_updater, j_updater_roundtrip);
}
TEST(GpuHist, MaxDepth) {
GenericParameter generic_param(CreateEmptyGenericParam(0));
size_t constexpr kRows = 16;
size_t constexpr kCols = 4;
auto p_mat = RandomDataGenerator{kRows, kCols, 0}.GenerateDMatrix();
auto learner = std::unique_ptr<Learner>(Learner::Create({p_mat}));
learner->SetParam("max_depth", "32");
learner->Configure();
ASSERT_THROW({learner->UpdateOneIter(0, p_mat);}, dmlc::Error);
}
} // namespace tree
} // namespace xgboost