code: def test_grad_log1msigm(self):
      # At some point, this returned nan, because (1 - sigm(x)) was
      # on both the numerator and the denominator of a fraction,
      # but the two nodes in question had not been merged.
      x = tensor.matrix("x")
      lr = tensor.scalar("lr")
  
      s = sigmoid(x)
      l = T.log(1 - s)
      c = l.mean()
      ux = x - lr * theano.grad(c, x)
  
      # Before the optimization, inf and NaN will be produced in the graph,
      # and DebugMode will complain. Everything is fine afterwards.
      mode = self.get_mode()
      if not isinstance(mode, theano.compile.DebugMode):
          f = theano.function([x, lr], ux, mode=mode)
          ux_v = f([[50]], 0.1)
          assert not np.isnan(ux_v)
  
imports: from __future__ import absolute_import, print_function, division
  import unittest
  import numpy
  from theano.compat import imap
  import theano.tensor.inplace
  from theano.tensor import basic
  from theano import tensor
  from theano import config
  from theano.gof.opt import check_stack_trace
  from theano.tests import unittest_tools
  from theano.tensor.nnet import sigmoid, sigmoid_inplace, softplus, ultra_fast_sigmoid, hard_sigmoid
  from theano.tensor.nnet.sigm import compute_mul, is_1pexp, parse_mul_tree, perform_sigm_times_exp, register_local_1msigmoid, simplify_mul
  from theano.tensor.tests.test_basic import makeBroadcastTester, copymod, check_floatX, upcast_int8_nfunc, _good_broadcast_unary_normal_no_complex
label_desc: Use image node_id 6 for calling the T_sigmoid_opts obj's underlying member method code with example usage: obj.test_grad_log1msigm() without return types