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

small fixes

上级 58452aba
...@@ -106,7 +106,7 @@ def contains_nan(arr, node=None, var=None): ...@@ -106,7 +106,7 @@ def contains_nan(arr, node=None, var=None):
""" """
if not _is_numeric_value(arr, var): if not _is_numeric_value(arr, var):
return False return False
elif "int" in getattr(arr, 'dtype', ''): elif "int" in str(getattr(arr, 'dtype', '')):
return False return False
elif pygpu_available and isinstance(arr, GpuArray): elif pygpu_available and isinstance(arr, GpuArray):
return np.isnan(f_gpua_min(arr.reshape(arr.size))) return np.isnan(f_gpua_min(arr.reshape(arr.size)))
......
...@@ -74,7 +74,7 @@ def test_NanGuardMode(): ...@@ -74,7 +74,7 @@ def test_NanGuardMode():
x = T.matrix(dtype='uint8') x = T.matrix(dtype='uint8')
w = theano.shared(np.random.randn(5, 7).astype(theano.config.floatX)) w = theano.shared(np.random.randn(5, 7).astype(theano.config.floatX))
y = T.dot(x, w) y = T.dot(x, w)
a = (np.random.randn(3, 5).astype(theano.config.floatX)*10).astype('uint8') a = (np.random.randn(3, 5).astype(theano.config.floatX) * 10).astype('uint8')
fun = theano.function( fun = theano.function(
[x], y, [x], y,
mode=NanGuardMode(nan_is_error=True, inf_is_error=True) mode=NanGuardMode(nan_is_error=True, inf_is_error=True)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论