提交 4d541b6a authored 作者: Frederic Bastien's avatar Frederic Bastien

better implementation of the allow_remove_inf check.

上级 5cde2e60
...@@ -544,13 +544,13 @@ class TensorType(Type): ...@@ -544,13 +544,13 @@ class TensorType(Type):
# Find places where both a and b have inf of the same sign. # Find places where both a and b have inf of the same sign.
both_inf = a_inf * numpy.isinf(b) both_inf = a_inf * numpy.isinf(b)
#check the sign of the inf:
for idx,v in enumerate(both_inf): #cmp_elemwise is True when we have inf and -inf.
if v: cmp_elemwise = numpy.where(both_inf&cmp_elemwise,
both_inf[idx] = a[idx]==b[idx] a==b,cmp_elemwise)
#cmp_elemwise is True when we have inf and -inf.
#So we need to override it. #check the sign of the inf
cmp_elemwise[idx]=a[idx]==b[idx] both_inf = numpy.where(both_inf,cmp_elemwise,both_inf)
if allow_remove_inf: if allow_remove_inf:
both_inf += a_inf both_inf += a_inf
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论