def test_grad(self): x = T.vector('x') a = np.random.random(50).astype(config.floatX) theano.function([x], T.grad(T.sum(diff(x)), x)) utt.verify_grad(self.op, [a]) for k in range(TestDiffOp.nb): theano.function([x], T.grad(T.sum(diff(x, n=k)), x)) utt.verify_grad(DiffOp(n=k), [a], eps=7e-3)
def setUp(self): super(TestDiffOp, self).setUp() self.op_class = DiffOp self.op = DiffOp()
def setup_method(self): super().setup_method() self.op_class = DiffOp self.op = DiffOp()