From: Junjie Bai Date: Sun, 31 Mar 2019 09:05:14 +0000 (-0700) Subject: Use proper isnan check X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~523 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=828a6a3b3943a0a0701ecacacd2bcc34fc03fe03;p=platform%2Fupstream%2Fpytorch.git Use proper isnan check Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18663 Differential Revision: D14699385 Pulled By: bddppq fbshipit-source-id: 596ad3371e7704802591e49f7e1c55dc6cd2896f --- diff --git a/aten/src/TH/generic/THTensorMoreMath.cpp b/aten/src/TH/generic/THTensorMoreMath.cpp index 0adf1a2..4661ef2 100644 --- a/aten/src/TH/generic/THTensorMoreMath.cpp +++ b/aten/src/TH/generic/THTensorMoreMath.cpp @@ -544,7 +544,7 @@ void THTensor_(diag)(THTensor *r_, THTensor *t, int k) /* Emulate NumPy behavior of putting NaNs * at the end of an ascending list. */ #define GT_OR_NAN(x, y) \ - ((x != x && y == y) || (x > y)) + ((th_isnan(x) && !(th_isnan(y))) || (x > y)) static void THTensor_(quicksortascend)(scalar_t *arr, int64_t *idx, int64_t elements, int64_t stride) {