提交 a3e5e023 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix nanguardmode which depends on _cdata_type.

上级 e7548e80
...@@ -65,7 +65,8 @@ def contains_nan(arr, node=None, var=None): ...@@ -65,7 +65,8 @@ def contains_nan(arr, node=None, var=None):
construction of a boolean array with the same shape as the input array. construction of a boolean array with the same shape as the input array.
""" """
if isinstance(arr, theano.gof.type.CDataType._cdata_type): # This should be a whitelist instead of a blacklist
if isinstance(arr, theano.gof.type._cdata_type):
return False return False
elif isinstance(arr, np.random.mtrand.RandomState): elif isinstance(arr, np.random.mtrand.RandomState):
return False return False
...@@ -114,7 +115,7 @@ def contains_inf(arr, node=None, var=None): ...@@ -114,7 +115,7 @@ def contains_inf(arr, node=None, var=None):
boolean array with the same shape as the input array. boolean array with the same shape as the input array.
""" """
if isinstance(arr, theano.gof.type.CDataType._cdata_type): if isinstance(arr, theano.gof.type._cdata_type):
return False return False
elif isinstance(arr, np.random.mtrand.RandomState): elif isinstance(arr, np.random.mtrand.RandomState):
return False return False
...@@ -250,7 +251,7 @@ class NanGuardMode(Mode): ...@@ -250,7 +251,7 @@ class NanGuardMode(Mode):
error = True error = True
if big_is_error: if big_is_error:
err = False err = False
if isinstance(value, theano.gof.type.CDataType._cdata_type): if isinstance(value, theano.gof.type._cdata_type):
err = False err = False
elif isinstance(value, np.random.mtrand.RandomState): elif isinstance(value, np.random.mtrand.RandomState):
err = False err = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论