Skip to content

Commit

Permalink
use std::abs instead gcc abs to avoid bugs occurs in different gcc ve…
Browse files Browse the repository at this point in the history
…rsion
  • Loading branch information
huangxu96 committed Sep 17, 2021
1 parent ceb2c43 commit 200562a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions paddle/fluid/operators/determinant_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ struct SlogDeterminantFunctor {
auto det_val = matrix.determinant();
sign_vec.push_back(sign(det_val));
det_val >= 0
? log_vec.push_back(log(det_val))
: log_vec.push_back(log(
abs(det_val))); // for computing log value of a negative value.
? log_vec.push_back(std::log(det_val))
: log_vec.push_back(std::log(std::abs(
det_val))); // for computing log value of a negative value.
}
// merge sign_vec and log_vec as final output_vec
output_vec.insert(output_vec.end(), sign_vec.begin(), sign_vec.end());
Expand Down

0 comments on commit 200562a

Please sign in to comment.