How to use the gradient._msg_retType function in gradient

To help you get started, we’ve selected a few gradient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Theano / Theano / theano / _test_gradient.py View on Github external
def test_retNone1(self): 
        """Test that it is not ok to return None from op.grad()"""
        class retNone(gof.op.Op):
            def make_node(self):
                inputs = [gof.generic()]
                outputs = [gof.generic()]
                return gof.Apply(self, inputs, outputs)
            def grad(self, (x, ), (gz, )):
                pass
        a = retNone().make_node()
        try:
            grad_sources_inputs([(a.out, 1)], None)
        except ValueError, e:
            self.failUnless(e[0] is gradient._msg_retType)
            return
        self.fail()
    def test_retNone1_b(self):