changed _isnan() and _finite() to std::isnan() and std::isfinite(), for GCC compat
This commit is contained in:
Родитель
3c836508f4
Коммит
f40f04074b
|
@ -8,10 +8,6 @@
|
|||
#define _FILEUTIL_
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#define isfinite(x) _finite(x)
|
||||
#define isnan(x) _isnan(x)
|
||||
#endif
|
||||
#ifdef __unix__
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -1147,7 +1147,7 @@ public:
|
|||
#else
|
||||
const auto & us = *this;
|
||||
foreach_coord (i, j, us)
|
||||
if (_isnan (us(i,j)))
|
||||
if (std::isnan (us(i,j)))
|
||||
{
|
||||
fprintf (stderr, "hasnan: NaN detected at %s (%d,%d)\n", name, i, j);
|
||||
return true;
|
||||
|
@ -1166,7 +1166,7 @@ public:
|
|||
foreach_coord (i, j, us)
|
||||
{
|
||||
auto val = us(i,j);
|
||||
if (_isnan (val) || !_finite (val))
|
||||
if (std::isnan (val) || !std::isfinite (val))
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
|
|
|
@ -1360,7 +1360,7 @@ protected:
|
|||
double eGradNum = (mbEvalCriPos - mbEvalCriNeg)/(ePos - eNeg);
|
||||
ElemType threshold = (ElemType) pow((ElemType)10.0, max((ElemType)0.0, ceil(log10(min(fabs(eGradErr), fabs(eGradNum)))))-(int)m_gradientCheckSigDigit);
|
||||
ElemType diff = (ElemType) fabs(eGradErr - eGradNum);
|
||||
bool wrong = (_isnan(diff) || diff > threshold);
|
||||
bool wrong = (std::isnan(diff) || diff > threshold);
|
||||
if (wrong)
|
||||
{
|
||||
fprintf (stderr, "\nd%ws Numeric gradient = %e, Error BP gradient = %e\n", node->NodeName().c_str(), eGradNum, eGradErr);
|
||||
|
|
|
@ -3915,7 +3915,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
const Matrix<ElemType> & us = *this;
|
||||
|
||||
foreach_coord (i, j, us)
|
||||
if (isnan(us(i, j)))
|
||||
if (std::isnan(us(i, j)))
|
||||
{
|
||||
fprintf (stderr, "hasnan: NaN detected at %s (%ld,%ld)\n", name, i, j);
|
||||
return true;
|
||||
|
@ -3935,7 +3935,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
|
|||
foreach_coord (i, j, us)
|
||||
{
|
||||
auto val = us(i,j);
|
||||
if (isnan (val) || !isfinite (val))
|
||||
if (std::isnan (val) || !std::isfinite (val))
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
|
|
Загрузка…
Ссылка в новой задаче