code: def test_disconnected_paths(self):
      # Test that taking gradient going through a disconnected
      # path rasises an exception
      T = theano.tensor
      a = np.asarray(self.rng.randn(5, 5), dtype=config.floatX)
  
      x = T.matrix("x")
  
      # This MUST raise a DisconnectedInputError error.
      # This also rasies an additional warning from gradients.py.
      self.assertRaises(
          gradient.DisconnectedInputError,
          gradient.grad,
          gradient.disconnected_grad(x).sum(),
          x,
      )
  
      # This MUST NOT raise a DisconnectedInputError error.
      y = gradient.grad((x + gradient.disconnected_grad(x)).sum(), x)
  
      a = T.matrix("a")
      b = T.matrix("b")
      y = a + gradient.disconnected_grad(b)
      # This MUST raise a DisconnectedInputError error.
      # This also rasies an additional warning from gradients.py.
      self.assertRaises(
          gradient.DisconnectedInputError, gradient.grad, y.sum(), b
      )
  
      # This MUST NOT raise a DisconnectedInputError error.
      gradient.grad(y.sum(), a)
  
imports: from __future__ import absolute_import, print_function, division
  from collections import OrderedDict
  import unittest
  import numpy
  from six.moves import xrange
  import theano
  from theano import gof, change_flags
  from theano.compat import izip
  from theano.tests import unittest_tools
  from theano import gradient
  from theano import config
  from theano.gof.null_type import NullType
  from theano.sandbox.rng_mrg import MRG_RandomStreams
label_desc: Use image node_id 5 for calling the TestDisconnectedGrad obj's underlying member method code with example usage: obj.test_disconnected_paths() without return types