diff options
author | soumith <soumith@fb.com> | 2016-02-28 04:02:26 +0300 |
---|---|---|
committer | soumith <soumith@fb.com> | 2016-02-28 04:02:26 +0300 |
commit | 594d4a58f256a6023136a10c86c25f18f1b6a62a (patch) | |
tree | 29675aa7fb2adfeee935c40ac2fc757f2a959ed6 | |
parent | d74fdce0de3e416bc79675cd93a6f44e490224e1 (diff) |
only check isnan for float typesisnan
-rw-r--r-- | lib/TH/generic/THTensorMath.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/TH/generic/THTensorMath.c b/lib/TH/generic/THTensorMath.c index 2900130..bf5d06b 100644 --- a/lib/TH/generic/THTensorMath.c +++ b/lib/TH/generic/THTensorMath.c @@ -398,8 +398,10 @@ real THTensor_(minall)(THTensor *tensor) if(!(value >= theMin)) { theMin = value; +#if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE) if (isnan(value)) break; +#endif }); return theMin; } @@ -417,8 +419,10 @@ real THTensor_(maxall)(THTensor *tensor) if(!(value <= theMax)) { theMax = value; +#if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE) if (isnan(value)) break; +#endif }); return theMax; } @@ -1041,8 +1045,10 @@ void THTensor_(max)(THTensor *values_, THLongTensor *indices_, THTensor *t, int { theIndex = i; theMax = value; +#if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE) if (isnan(value)) break; +#endif } } *indices__data = theIndex; @@ -1078,8 +1084,10 @@ void THTensor_(min)(THTensor *values_, THLongTensor *indices_, THTensor *t, int { theIndex = i; theMin = value; +#if defined(TH_REAL_IS_FLOAT) || defined(TH_REAL_IS_DOUBLE) if (isnan(value)) break; +#endif } } *indices__data = theIndex; |