def test_unimplemented_grad_grad(self):
# tests that unimplemented grads are caught in the grad method
class DummyOp(gof.Op):
__props__ = ()
def make_node(self, x):
return gof.Apply(self, [x], [x.type()])
def grad(self, inputs, output_grads):
return [theano.gradient.grad_not_implemented(self, 0, inputs[0])]
a = theano.tensor.scalar()
b = DummyOp()(a)
self.assertRaises(TypeError, theano.gradient.grad, b, a)
评论列表
文章目录