Skip to content

Commit ba877c9

Browse files
author
Alice
committed
Use std:: versions of isinf
1 parent 36ff840 commit ba877c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

faster-rnnlm/rnnlm.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <string>
1515
#include <vector>
16+
#include <cmath>
1617

1718
#include "faster-rnnlm/hierarchical_softmax.h"
1819
#include "faster-rnnlm/layers/interface.h"
@@ -445,9 +446,9 @@ void TrainLM(
445446
}
446447

447448
Real ratio = bl_entropy / entropy;
448-
if (isnan(entropy) || isinf(entropy) || !(ratio >= bad_ratio)) {
449+
if (std::isnan(entropy) || std::isinf(entropy) || !(ratio >= bad_ratio)) {
449450
// !(ratio >= bad_ratio) will catch nan and inf even in fastmath mode
450-
if (isnan(entropy) || isinf(entropy) || !(ratio >= awful_ratio)) {
451+
if (std::isnan(entropy) || std::isinf(entropy) || !(ratio >= awful_ratio)) {
451452
fprintf(stderr, "\tAwful: Nnet rejected");
452453
nnet->ReLoad(model_weight_file);
453454
} else {

0 commit comments

Comments
 (0)