liblloyal 1.0.0
Branched Inference for llama.cpp
Loading...
Searching...
No Matches
lloyal::metrics::detail Namespace Reference

Functions

float max_finite (const float *a, int n)
 Find maximum finite value in array Used for log-sum-exp shift to prevent overflow.
 
float log_sum_exp (const float *a, int n, float shift)
 Numerically stable log-sum-exp Computes log(Σ exp(aᵢ)) using shift trick to avoid overflow.
 

Variables

constexpr float LN2 = 0.693147180559945309417232121458176568f
 

Function Documentation

◆ log_sum_exp()

float lloyal::metrics::detail::log_sum_exp ( const float *  a,
int  n,
float  shift 
)
inline

Numerically stable log-sum-exp Computes log(Σ exp(aᵢ)) using shift trick to avoid overflow.

Parameters
aArray of log-space values
nArray length
shiftMax value for numerical stability
Returns
log(Σ exp(aᵢ))
Examples
/home/runner/work/liblloyal/liblloyal/include/lloyal/metrics.hpp.

Definition at line 76 of file metrics.hpp.

◆ max_finite()

float lloyal::metrics::detail::max_finite ( const float *  a,
int  n 
)
inline

Find maximum finite value in array Used for log-sum-exp shift to prevent overflow.

Examples
/home/runner/work/liblloyal/liblloyal/include/lloyal/metrics.hpp.

Definition at line 58 of file metrics.hpp.

Variable Documentation

◆ LN2

constexpr float lloyal::metrics::detail::LN2 = 0.693147180559945309417232121458176568f
constexpr