fix isnan check for int

This commit is contained in:
Dun Liang 2022-11-19 10:55:04 +08:00
parent fd5bd4aba9
commit ef55bd378f
2 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.3.5.35'
__version__ = '1.3.5.36'
from jittor_utils import lock
with lock.lock_scope():
ori_int = int

View File

@ -1967,15 +1967,15 @@ def _simple_for(x, func):
'''
return jt.code(x.shape, "bool", [x], cpu_src=src, cuda_src=src)
def isnan(x): return _simple_for(x, "isnan(x)")
def isnan(x): return _simple_for(x, "isnan(float(x))")
jt.Var.isnan = isnan
def isfinite(x): return _simple_for(x, "!isnan(x) && !isinf(x)")
def isfinite(x): return _simple_for(x, "!isnan(float(x)) && !isinf(float(x))")
jt.Var.isfinite = isfinite
def isinf(x): return _simple_for(x, "isinf(x)")
def isinf(x): return _simple_for(x, "isinf(float(x))")
jt.Var.isinf = isinf
def isneginf(x): return _simple_for(x, "x<0 && isinf(x)")
def isneginf(x): return _simple_for(x, "x<0 && isinf(float(x))")
jt.Var.isneginf = isneginf
def isposinf(x): return _simple_for(x, "x>0 && isinf(x)")
def isposinf(x): return _simple_for(x, "x>0 && isinf(float(x))")
jt.Var.isposinf = isposinf
# fake torch interface