提交 d73923e5 authored 作者: Frederic's avatar Frederic

Fix crash in Alloc grad

上级 9dc07802
......@@ -2523,7 +2523,7 @@ class Alloc(gof.Op):
new_order = list(x.broadcastable)
idx = 0
for i in range(x.ndim):
if not new_order[i]:
if i not in axis_broadcasted:
new_order[i] = idx
idx += 1
else:
......
......@@ -2062,6 +2062,19 @@ Allocb4GradTester = makeBroadcastTester(
)
# Partial un broadcast of a dimshuffled input
AllocDimshuffleGradTester = makeBroadcastTester(
name='Allocb4GradTester',
op=lambda x: alloc(x.dimshuffle('x', 'x', 0), 1, s2, s3),
expected=(lambda x: numpy.zeros((1, s2, s3), dtype=x.dtype) + x),
grad=dict(
x1=(rand(s3),),
x2=(rand(s3),),
x3=(rand(s3),),
),
)
class ApplyDefaultTestOp(theano.Op):
def __init__(self, id):
self.default_output = id
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论