提交 e5afb22c authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Fixed a large bunch of bugs when I copied things over.

Sorry guys, this copying things from one side to the other is harder then I thought, but I think I figured out how to do it ;)
上级 26c75589
......@@ -1783,7 +1783,7 @@ class SpecifyShape(Op):
return [specify_shape(gz,s), None]
def R_op(self, inputs, eval_points):
return [zeros_like(x) for x in self.make_node(*inputs).outputs ]
return self.make_node(eval_points[0], *inputs[1:]).outputs
specify_shape = SpecifyShape()
......
......@@ -22,7 +22,7 @@ class test_rop(unittest.TestCase):
v = TT.vector('v')
y = TT.specify_shape(x, (5,))
yv = TT.Rop(y,x,v)
rop_f = function([v,x], yv)
rop_f = function([x,v], yv)
J, _ = theano.scan( lambda i,y,x: TT.grad(y[i],x),
sequences = TT.arange(x.shape[0]),
non_sequences = [y,x])
......@@ -32,7 +32,7 @@ class test_rop(unittest.TestCase):
v1 = rop_f(vx,vv)
v2 = scan_f(vx,vv)
assert numpy.allclose(v1,v1)
assert numpy.allclose(v1,v2)
class test_lop(unittest.TestCase):
......@@ -46,7 +46,7 @@ class test_lop(unittest.TestCase):
v = TT.vector('v')
y = TT.specify_shape(x, (5,))
yv = TT.Lop(y,x,v)
rop_f = function([v,x], yv)
rop_f = function([x,v], yv)
J, _ = theano.scan( lambda i,y,x: TT.grad(y[i],x),
sequences = TT.arange(x.shape[0]),
non_sequences = [y,x])
......@@ -56,6 +56,6 @@ class test_lop(unittest.TestCase):
v1 = rop_f(vx,vv)
v2 = scan_f(vx,vv)
assert numpy.allclose(v1,v1)
assert numpy.allclose(v1,v2)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论