提交 74cc080d authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Merge pull request #1328 from SinaHonari/myBranch

removing a bug
......@@ -821,7 +821,7 @@ class Elemwise(Op):
# Determine the shape of outputs
out_shape = []
for values in izip(*[input.shape for input in inputs]):
if numpy.prod(values) == 0:
if any(v == 0 for v in values):
# All non-broadcasted dimensions should be zero
assert max(values) <= 1
out_shape.append(0)
......
......@@ -986,6 +986,16 @@ class TestElemwise(unittest_tools.InferShapeTester):
[Elemwise(scalar.add)(t_left, t_right)],
[t_left_val, t_right_val], Elemwise)
def test_input_dimensions_overflow(self):
# Elemwise.perform used to compute the product
# of input shapes to check if there was a zero in them,
# it overflowed in this case.
a, b, c, d, e, f = tensor.vectors('abcdef')
s = a + b + c + d + e + f
g = theano.function([a, b, c, d, e, f], s,
mode=theano.compile.Mode(linker='py'))
g(*[numpy.zeros(2 ** 11, config.floatX) for i in range(6)])
def test_gt_grad():
"""A user test that failed.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论