Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warning about signed vs unsigned ints #6053

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cpp/src/fil/treelite_import.cu
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,11 @@ void tl2fil_common(forest_params_t* params,
ASSERT(model.num_target == 1, "FIL does not support multi-target models");

// assuming either all leaves use the .leaf_vector() or all leaves use .leaf_value()
size_t leaf_vec_size = tl_leaf_vector_size(model);
std::size_t leaf_vec_size = tl_leaf_vector_size(model);
std::string pred_transform(model.postprocessor);
if (leaf_vec_size > 0) {
ASSERT(leaf_vec_size == model.num_class[0], "treelite model inconsistent");
ASSERT(leaf_vec_size == static_cast<std::size_t>(model.num_class[0]),
"treelite model inconsistent");
params->num_classes = leaf_vec_size;
params->leaf_algo = leaf_algo_t::VECTOR_LEAF;

Expand All @@ -513,7 +514,8 @@ void tl2fil_common(forest_params_t* params,
// Ensure that the trees follow the grove-per-class layout.
for (size_t tree_id = 0; tree_id < model_preset.trees.size(); ++tree_id) {
ASSERT(model.target_id[tree_id] == 0, "FIL does not support multi-target models");
ASSERT(model.class_id[tree_id] == tree_id % static_cast<size_t>(model.num_class[0]),
ASSERT(static_cast<std::size_t>(model.class_id[tree_id]) ==
tree_id % static_cast<size_t>(model.num_class[0]),
"The tree model is not compatible with FIL; the trees must be laid out "
"such that tree i's output contributes towards class (i %% num_class).");
}
Expand Down
Loading