提交 10535543 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Less redundant tests

上级 c04fb945
...@@ -1139,7 +1139,11 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val, ...@@ -1139,7 +1139,11 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
if 'wrong_size' in prealloc_modes or 'ALL' in prealloc_modes: if 'wrong_size' in prealloc_modes or 'ALL' in prealloc_modes:
# For each dimension, try size-1, size, size+1 # For each dimension, try size-1, size, size+1
for shape_diff in itertools_product((-1, 0, 1), repeat=max_ndim): for dim in xrange(max_ndim):
shape_diff = [0] * max_ndim
for diff in (-1, 1):
shape_diff[dim] = diff
wrong_size = {} wrong_size = {}
name = 'wrong_size%s' % str(tuple(shape_diff)) name = 'wrong_size%s' % str(tuple(shape_diff))
...@@ -1147,7 +1151,8 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val, ...@@ -1147,7 +1151,8 @@ def _get_preallocated_maps(node, thunk, prealloc_modes, def_val,
if isinstance(r.type, (TensorType, CudaNdarrayType)): if isinstance(r.type, (TensorType, CudaNdarrayType)):
r_shape_diff = shape_diff[:r.ndim] r_shape_diff = shape_diff[:r.ndim]
out_shape = [max((s + sd), 0) out_shape = [max((s + sd), 0)
for s, sd in zip(r_vals[r].shape, r_shape_diff)] for s, sd in zip(r_vals[r].shape,
r_shape_diff)]
new_buf = numpy.zeros( new_buf = numpy.zeros(
shape=out_shape, shape=out_shape,
dtype=r.dtype) dtype=r.dtype)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论