From 828a6a3b3943a0a0701ecacacd2bcc34fc03fe03 Mon Sep 17 00:00:00 2001 From: Junjie Bai Date: Sun, 31 Mar 2019 02:05:14 -0700 Subject: [PATCH] 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 --- aten/src/TH/generic/THTensorMoreMath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.7.4