提交 69559928 authored 作者: Frederic's avatar Frederic

Fix test in the daily buildbot by doing the comparison on ndarray, not CudaNdarray.

上级 50dc3dd5
...@@ -1069,8 +1069,9 @@ def local_gpu_conv(node): ...@@ -1069,8 +1069,9 @@ def local_gpu_conv(node):
assert a.ndim == 4 assert a.ndim == 4
atol = None atol = None
if a.shape[-1] * a.shape[-2] > 100: if a.shape[-1] * a.shape[-2] > 100:
#For float32 the default atol is 1e-5
atol = 3e-5 atol = 3e-5
return tensor.TensorType.values_eq_approx(a, b, atol=atol) return CudaNdarrayType.values_eq_approx(a, b, atol=atol)
if node.op == gpu_from_host: if node.op == gpu_from_host:
#gpu_from_host(conv) -> gpu_conv(gpu_from_host) #gpu_from_host(conv) -> gpu_conv(gpu_from_host)
......
...@@ -183,11 +183,16 @@ class CudaNdarrayType(Type): ...@@ -183,11 +183,16 @@ class CudaNdarrayType(Type):
return tensor.TensorType.values_eq(numpy.asarray(a), numpy.asarray(b)) return tensor.TensorType.values_eq(numpy.asarray(a), numpy.asarray(b))
@staticmethod @staticmethod
def values_eq_approx(a, b, allow_remove_inf=False): def values_eq_approx(a, b, allow_remove_inf=False, allow_remove_nan=False,
rtol=None, atol=None):
#TODO: make the comparaison without transfert. #TODO: make the comparaison without transfert.
return tensor.TensorType.values_eq_approx(numpy.asarray(a), return tensor.TensorType.values_eq_approx(
numpy.asarray(b), numpy.asarray(a),
allow_remove_inf=allow_remove_inf) numpy.asarray(b),
allow_remove_inf=allow_remove_inf,
allow_remove_nan=allow_remove_nan,
rtol=rtol, atol=atol
)
def dtype_specs(self): def dtype_specs(self):
"""Return a tuple (python type, c type, numpy typenum) that """Return a tuple (python type, c type, numpy typenum) that
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论