提交 46001e3e authored 作者: James Bergstra's avatar James Bergstra

TensrType.values_eq_approx - commented out the special case for scalars since it

was buggy (didn't respect dtypes) and seems unnecessary.
上级 2674f99c
...@@ -484,12 +484,12 @@ class TensorType(Type): ...@@ -484,12 +484,12 @@ class TensorType(Type):
return False return False
if 'int' in str(a.dtype): if 'int' in str(a.dtype):
return numpy.all(a==b) return numpy.all(a==b)
elif a.shape == (): #for comparing scalars, use broadcasting. #elif a.shape == (): #for comparing scalars, use broadcasting.
# Note: according to James B, there was a reason for the ## Note: according to James B, there was a reason for the
# following two lines, that may seem weird at first glance. ## following two lines, that may seem weird at first glance.
# If someone can figure out what it is, please say it here! ## If someone can figure out what it is, please say it here!
ones = numpy.ones(2) #ones = numpy.ones(2)
return _allclose(ones * a, ones*b) #return _allclose(ones * a, ones*b)
else: else:
cmp = _allclose(a, b) cmp = _allclose(a, b)
if cmp: if cmp:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论