提交 f6e913a9 authored 作者: Frederic Bastien's avatar Frederic Bastien

Same fix for isinf.

上级 46969ae5
...@@ -1832,6 +1832,7 @@ isnan_ = isnan ...@@ -1832,6 +1832,7 @@ isnan_ = isnan
def isnan(a): def isnan(a):
"""isnan(a)""" """isnan(a)"""
a = as_tensor_variable(a)
if a.dtype in discrete_dtypes: if a.dtype in discrete_dtypes:
return alloc(numpy.asarray(False, dtype="bool"), return alloc(numpy.asarray(False, dtype="bool"),
*[a.shape[i] for i in range(a.ndim)]) *[a.shape[i] for i in range(a.ndim)])
...@@ -1843,6 +1844,20 @@ def isinf(a): ...@@ -1843,6 +1844,20 @@ def isinf(a):
"""isinf(a)""" """isinf(a)"""
# Rename isnan to isnan_ to allow to bypass it when not needed.
# glibc 2.23 don't allow isnan on int, so we remove it from the graph.
isinf_ = isinf
def isinf(a):
"""isinf(a)"""
a = as_tensor_variable(a)
if a.dtype in discrete_dtypes:
return alloc(numpy.asarray(False, dtype="bool"),
*[a.shape[i] for i in range(a.ndim)])
return isinf_(a)
def allclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False): def allclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False):
""" """
Implement Numpy's ``allclose`` on tensors. Implement Numpy's ``allclose`` on tensors.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论