提交 2e06c87e authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #5173 from lamblin/fix_debugmode

Fix some failing tests in debugmode
...@@ -2855,6 +2855,10 @@ def copy_stack_trace(from_var, to_var): ...@@ -2855,6 +2855,10 @@ def copy_stack_trace(from_var, to_var):
# so just store that particular stack trace # so just store that particular stack trace
tr = getattr(from_var.tag, 'trace', []) tr = getattr(from_var.tag, 'trace', [])
if tr and isinstance(tr[0], tuple):
# There was one single stack trace, we encapsulate it in a list
tr = [tr]
# Copy over stack traces to to_var # Copy over stack traces to to_var
if type(to_var) is list: if type(to_var) is list:
# Copy over stack traces from from_var to each variable in # Copy over stack traces from from_var to each variable in
......
...@@ -26,6 +26,7 @@ def get_diagonal_subtensor_view(x, i0, i1): ...@@ -26,6 +26,7 @@ def get_diagonal_subtensor_view(x, i0, i1):
idx[i0] = slice(x.shape[i1] - 1, None, None) idx[i0] = slice(x.shape[i1] - 1, None, None)
xview = x.__getitem__(tuple(idx)) xview = x.__getitem__(tuple(idx))
strides = list(xview.strides) strides = list(xview.strides)
if x.shape[i1] != 1:
strides[i1] -= strides[i0] strides[i1] -= strides[i0]
xview.strides = strides xview.strides = strides
return xview return xview
......
...@@ -870,6 +870,10 @@ class T_reduce_dtype(unittest.TestCase): ...@@ -870,6 +870,10 @@ class T_reduce_dtype(unittest.TestCase):
(topo, output_dtype) (topo, output_dtype)
data = numpy.random.rand(3, 4) * 10 data = numpy.random.rand(3, 4) * 10
data = data.astype(input_dtype) data = data.astype(input_dtype)
if output_dtype == 'float16' and method == 'prod':
# We will likely get something infinite,
# and DebugMode will complain.
data = data[0:1]
f(data) f(data)
if "complex" in input_dtype: if "complex" in input_dtype:
continue continue
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论