code: def test_check_isfinite(self):
      x = theano.tensor.vector()
      f = theano.function([x], (x + 2) * 5, mode="DEBUG_MODE")
      g = theano.function([x], theano.tensor.log(x), mode="DEBUG_MODE")
  
      # this should work
      f(np.log([3, 4, 5]).astype(config.floatX))
  
      # if TensorType.filter_checks_isfinite were true, these would raise
      # ValueError
      # if not, DebugMode will check internally, and raise InvalidValueError
      # passing an invalid value as an input should trigger ValueError
      self.assertRaises(
          debugmode.InvalidValueError,
          f,
          np.log([3, -4, 5]).astype(config.floatX),
      )
      self.assertRaises(
          debugmode.InvalidValueError,
          f,
          (np.asarray([0, 1.0, 0]) / 0).astype(config.floatX),
      )
      self.assertRaises(
          debugmode.InvalidValueError,
          f,
          (np.asarray([1.0, 1.0, 1.0]) / 0).astype(config.floatX),
      )
  
      # generating an invalid value internally should trigger
      # InvalidValueError
      self.assertRaises(
          debugmode.InvalidValueError,
          g,
          np.asarray([3, -4, 5], dtype=config.floatX),
      )
  
      # this should disable the exception
      theano.tensor.TensorType.filter_checks_isfinite = False
      theano.compile.mode.predefined_modes[
          "DEBUG_MODE"
      ].check_isfinite = False
      # insert several Inf
      f(
          np.asarray(
              np.asarray([1.0, 1.0, 1.0]) / 0, dtype=config.floatX
          )
      )
  
imports: from __future__ import absolute_import, print_function, division
  import sys
  import unittest
  from nose.plugins.skip import SkipTest
  import numpy
  from six import reraise
  from theano import config
  from theano import gof
  import theano
  from theano.compat import exc_message
  from theano.compile import debugmode
  import theano.tensor
  from theano.tests import unittest_tools
label_desc: Use image node_id 3 for calling the Test_check_isfinite obj's underlying member method code with example usage: obj.test_check_isfinite() without return types