Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShvetsKS committed Jun 26, 2022
1 parent 58ef17f commit 3ccb329
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/common/hist_util.h
Expand Up @@ -181,6 +181,29 @@ using BinTypeSizeSequence = std::integer_sequence<uint32_t,
BinTypeSize::kUint32BinsTypeSize>;
using BoolSequence = std::integer_sequence<bool, true, false>;



/**
* \brief Dispatch for bin type, fn is a function that accepts a scalar of the bin type.
*/
template <typename Fn>
auto DispatchBinType(BinTypeSize type, Fn&& fn) {
switch (type) {
case kUint8BinsTypeSize: {
return fn(uint8_t{});
}
case kUint16BinsTypeSize: {
return fn(uint16_t{});
}
case kUint32BinsTypeSize: {
return fn(uint32_t{});
}
}
LOG(FATAL) << "Unreachable";
return fn(uint32_t{});
}


/**
* \brief Optionally compressed gradient index. The compression works only with dense
* data.
Expand Down
1 change: 0 additions & 1 deletion src/data/gradient_index.h
Expand Up @@ -82,7 +82,6 @@ class GHistIndexMatrix {
GHistIndexMatrix(DMatrix* x, bst_bin_t max_bins_per_feat, double sparse_thresh,
bool sorted_sketch, int32_t n_threads, common::Span<float> hess = {});
~GHistIndexMatrix();

// Create a global histogram matrix, given cut. Used by external memory
void Init(SparsePage const& page, common::Span<FeatureType const> ft,
common::HistogramCuts const& cuts, int32_t max_bins_per_feat, bool is_dense,
Expand Down

0 comments on commit 3ccb329

Please sign in to comment.