Unify max nodes. (#5497)

This commit is contained in:
Jiaming Yuan
2020-04-10 19:26:35 +08:00
committed by GitHub
parent bd653fad4c
commit 866a477319
4 changed files with 16 additions and 22 deletions

View File

@@ -53,16 +53,7 @@ void FeatureInteractionConstraint::Configure(
}
// --- Initialize allowed features attached to nodes.
if (param.max_depth == 0 && param.max_leaves == 0) {
LOG(FATAL) << "Max leaves and max depth cannot both be unconstrained for gpu_hist.";
}
int32_t n_nodes {0};
if (param.max_depth != 0) {
n_nodes = std::pow(2, param.max_depth + 1);
} else {
n_nodes = param.max_leaves * 2 - 1;
}
CHECK_NE(n_nodes, 0);
int32_t n_nodes { param.MaxNodes() };
node_constraints_.resize(n_nodes);
node_constraints_storage_.resize(n_nodes);
for (auto& n : node_constraints_storage_) {