Skip to content

Commit

Permalink
cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Mar 10, 2023
1 parent d3525b0 commit 7bba719
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 10 deletions.
4 changes: 0 additions & 4 deletions src/common/ranking_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ void RankingCache::InitOnCPU(Context const* ctx, MetaInfo const& info) {
sum_weights += weight[k];
}
weight_norm_ = static_cast<double>(n_groups) / sum_weights;

auto const& h_label = info.labels.HostView().Slice(linalg::All(), 0);
is_binary_ = IsBinaryRel(
h_label, [ctx](auto beg, auto end, auto op) { return common::AllOf(ctx, beg, end, op); });
}

common::Span<std::size_t const> RankingCache::MakeRankOnCPU(Context const* ctx,
Expand Down
3 changes: 0 additions & 3 deletions src/common/ranking_utils.cu
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ void RankingCache::InitOnCUDA(Context const* ctx, MetaInfo const& info) {
auto w_it =
dh::MakeTransformIterator<double>(thrust::make_counting_iterator(0ul), WeightOp{weight});
weight_norm_ = static_cast<double>(n_groups) / thrust::reduce(w_it, w_it + n_groups);

auto const d_label = info.labels.View(ctx->gpu_id).Slice(linalg::All(), 0);
is_binary_ = IsBinaryRel(d_label, CheckMAPOp{ctx->CUDACtx()});
}

common::Span<std::size_t const> RankingCache::MakeRankOnCUDA(Context const* ctx,
Expand Down
3 changes: 0 additions & 3 deletions src/common/ranking_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ class RankingCache {
std::size_t max_group_size_{0};
// Normalization for weight
double weight_norm_{1.0};
// Whether label is binary
bool is_binary_{false};
/**
* CUDA cache
*/
Expand Down Expand Up @@ -227,7 +225,6 @@ class RankingCache {
[[nodiscard]] auto const& Param() const { return param_; }
[[nodiscard]] std::size_t Groups() const { return group_ptr_.Size() - 1; }
[[nodiscard]] double WeightNorm() const { return weight_norm_; }
[[nodiscard]] bool IsBinary() const { return is_binary_; }

// Create a rank list by model prediction
common::Span<std::size_t const> SortedIdx(Context const* ctx, common::Span<float const> predt) {
Expand Down

0 comments on commit 7bba719

Please sign in to comment.