Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Razdoburdin committed Dec 6, 2024
1 parent bd83108 commit 7ca7faf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/objective/lambdarank_obj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ class LambdaRankObj : public FitIntercept {
lj_full_.View(ctx_->Device()), &ti_plus_, &tj_minus_,
&li_, &lj_, p_cache_);
} else {
cpu_impl::LambdaRankUpdatePositionBias(ctx_, li_full_.View(ctx_->Device().IsSycl() ? DeviceOrd::CPU() : ctx_->Device()),
lj_full_.View(ctx_->Device().IsSycl() ? DeviceOrd::CPU() : ctx_->Device()), &ti_plus_, &tj_minus_,
// This function doesn't have sycl-specific implementation yet.
// For that reason we transfer data to host in case of sycl is used for propper execution.
auto device = ctx_->Device().IsSycl() ? DeviceOrd::CPU() : ctx_->Device();
cpu_impl::LambdaRankUpdatePositionBias(ctx_, li_full_.View(device),
lj_full_.View(device), &ti_plus_, &tj_minus_,
&li_, &lj_, p_cache_);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/cpp/objective/test_lambdarank_obj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void TestNDCGGPair(Context const* ctx) {
{0, 2, 4},
{2.06611f, -2.06611f, 0.0f, 0.0f},
{2.169331f, 2.169331f, 0.0f, 0.0f});

CheckRankingObjFunction(obj,
{0, 0.1f, 0, 0.1f},
{0, 1, 0, 1},
Expand All @@ -64,6 +65,7 @@ void TestNDCGGPair(Context const* ctx) {
{2.06611f, -2.06611f, 2.06611f, -2.06611f},
{2.169331f, 2.169331f, 2.169331f, 2.169331f});
}

std::unique_ptr<xgboost::ObjFunction> obj{xgboost::ObjFunction::Create("rank:ndcg", ctx)};
obj->Configure(Args{{"lambdarank_pair_method", "topk"}});

Expand Down

0 comments on commit 7ca7faf

Please sign in to comment.