提交 610b1d16 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

R_op for print and a test for it

上级 a2480e41
...@@ -140,6 +140,9 @@ class Print(Op): ...@@ -140,6 +140,9 @@ class Print(Op):
def grad(self, input, output_gradients): def grad(self, input, output_gradients):
return output_gradients return output_gradients
def R_op(self, inputs, eval_points):
return eval_points
def __eq__(self, other): def __eq__(self, other):
return (type(self) == type(other) and self.message == other.message return (type(self) == type(other) and self.message == other.message
and self.attrs == other.attrs) and self.attrs == other.attrs)
......
...@@ -216,6 +216,10 @@ class test_RopLop(RopLop_checker): ...@@ -216,6 +216,10 @@ class test_RopLop(RopLop_checker):
out = tensor.set_subtensor(self.x[:3], t) out = tensor.set_subtensor(self.x[:3], t)
self.check_rop_lop(out, self.in_shape) self.check_rop_lop(out, self.in_shape)
def test_print(self):
out = theano.printing.Print('x',attrs=('shape',))(self.x)
self.check_rop_lop(out, self.in_shape)
def test_setsubtensor2(self): def test_setsubtensor2(self):
tv = numpy.asarray( self.rng.uniform(size=(10,)), tv = numpy.asarray( self.rng.uniform(size=(10,)),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论