From 594d4a58f256a6023136a10c86c25f18f1b6a62a Mon Sep 17 00:00:00 2001 From: soumith Date: Sat, 27 Feb 2016 17:02:26 -0800 Subject: only check isnan for float types --- lib/TH/generic/THTensorMath.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3