Skip to content

Commit

Permalink
rename is_float_eq -> is_float_close
Browse files Browse the repository at this point in the history
  • Loading branch information
cebtenzzre committed Oct 4, 2023
1 parent bde943e commit 4cffcb8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static void replace_all(std::string & s, const std::string & search, const std::
s = std::move(result);
}

static bool is_float_eq(float a, float b, float abs_tol) {
static bool is_float_close(float a, float b, float abs_tol) {
// Check for non-negative tolerance
if (abs_tol < 0.0) {
throw std::invalid_argument("Tolerance must be non-negative");
Expand Down Expand Up @@ -981,10 +981,10 @@ struct llama_hparams {

const float EPSILON = 1e-9;

if (!is_float_eq(this->f_norm_eps, other.f_norm_eps, EPSILON)) return true;
if (!is_float_eq(this->f_norm_rms_eps, other.f_norm_rms_eps, EPSILON)) return true;
if (!is_float_eq(this->rope_freq_base_train, other.rope_freq_base_train, EPSILON)) return true;
if (!is_float_eq(this->rope_freq_scale_train, other.rope_freq_scale_train, EPSILON)) return true;
if (!is_float_close(this->f_norm_eps, other.f_norm_eps, EPSILON)) return true;
if (!is_float_close(this->f_norm_rms_eps, other.f_norm_rms_eps, EPSILON)) return true;
if (!is_float_close(this->rope_freq_base_train, other.rope_freq_base_train, EPSILON)) return true;
if (!is_float_close(this->rope_freq_scale_train, other.rope_freq_scale_train, EPSILON)) return true;

return false;
}
Expand Down

0 comments on commit 4cffcb8

Please sign in to comment.