pub struct QuantSpec {
pub inv_grad_scale: f32,
pub inv_hess_scale: f32,
pub grad_scale: f64,
pub hess_scale: f64,
pub grad_max_q: i32,
pub hess_max_q: i32,
pub constant_hessian: bool,
pub stochastic: bool,
pub seed: u32,
pub iteration: u32,
}Expand description
What one iteration’s quantization needs; mirrored by QuantParams in the kernels.
Fields§
§inv_grad_scale: f321 / grad_scale, where grad_scale = max |g| / (num_grad_quant_bins / 2) over every rank.
inv_hess_scale: f321 / hess_scale, where hess_scale = max h / num_grad_quant_bins; unused with a constant hessian.
grad_scale: f64§hess_scale: f64§grad_max_q: i32num_grad_quant_bins / 2.
hess_max_q: i32num_grad_quant_bins.
constant_hessian: boolEvery hessian equals hess_scale, so h_q is 1 and hessian sums are exact row counts.
stochastic: bool§seed: u32§iteration: u32Implementations§
Source§impl QuantSpec
impl QuantSpec
Sourcepub fn new(
max_abs_grad: f64,
max_hess: f64,
constant_hessian: Option<f64>,
num_bins: u32,
stochastic: bool,
seed: u32,
iteration: u32,
) -> QuantSpec
pub fn new( max_abs_grad: f64, max_hess: f64, constant_hessian: Option<f64>, num_bins: u32, stochastic: bool, seed: u32, iteration: u32, ) -> QuantSpec
LightGBM GradientDiscretizer::DiscretizeGradients scales from the global maxima. All-zero gradients get
scale 1 so the inverse stays finite.
Sourcepub fn max_rows_per_packed_block(&self) -> u32
pub fn max_rows_per_packed_block(&self) -> u32
Rows per GPU threadgroup so a packed i32 (two i16 halves) histogram bin never overflows.
Trait Implementations§
impl Copy for QuantSpec
impl StructuralPartialEq for QuantSpec
Auto Trait Implementations§
impl Forget for QuantSpec
impl Freeze for QuantSpec
impl Move for QuantSpec
impl RefUnwindSafe for QuantSpec
impl Send for QuantSpec
impl Sync for QuantSpec
impl Unpin for QuantSpec
impl UnsafeUnpin for QuantSpec
impl UnwindSafe for QuantSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more