提交 31e48192 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix in perform when reducing over 0-length dim

上级 cfb66e1d
......@@ -1209,8 +1209,12 @@ class CAReduce(Op):
# if available
if variable.shape[dimension] == 0:
if hasattr(self.scalar_op, 'identity'):
variable = numpy.array(self.scalar_op.identity)
break
# Compute the shape of the output
v_shape = list(variable.shape)
del v_shape[dimension]
variable = numpy.empty(tuple(v_shape),
dtype=variable.dtype)
variable.fill(self.scalar_op.identity)
else:
raise ValueError((
"Input (%s) has zero-size on axis %s, but "
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论