File: test_node_partition.cc

package info (click to toggle)
xgboost 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,796 kB
  • sloc: cpp: 67,502; python: 35,503; java: 4,676; ansic: 1,426; sh: 1,320; xml: 1,197; makefile: 204; javascript: 19
file content (29 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Copyright 2023 by XGBoost contributors
 */
#include <gtest/gtest.h>
#include <xgboost/context.h>       // for Context
#include <xgboost/task.h>          // for ObjInfo
#include <xgboost/tree_updater.h>  // for TreeUpdater

#include <memory>  // for unique_ptr

#include "../helpers.h"

namespace xgboost {
TEST(Updater, HasNodePosition) {
  Context ctx;
  ObjInfo task{ObjInfo::kRegression, true, true};
  std::unique_ptr<TreeUpdater> up{TreeUpdater::Create("grow_histmaker", &ctx, &task)};
  ASSERT_TRUE(up->HasNodePosition());

  up.reset(TreeUpdater::Create("grow_quantile_histmaker", &ctx, &task));
  ASSERT_TRUE(up->HasNodePosition());

#if defined(XGBOOST_USE_CUDA)
  ctx = MakeCUDACtx(0);
  up.reset(TreeUpdater::Create("grow_gpu_hist", &ctx, &task));
  ASSERT_TRUE(up->HasNodePosition());
#endif  // defined(XGBOOST_USE_CUDA)
}
}  // namespace xgboost