code: def test_perform_sigm_times_exp(self):
      # Test the core function doing the `sigm_times_exp` optimization.
      #
      # It is easier to test different graph scenarios this way than by
      # compiling a theano function.
  
      x, y, z, t = tensor.vectors("x", "y", "z", "t")
      exp = tensor.exp
  
      def ok(expr1, expr2):
          trees = [parse_mul_tree(e) for e in (expr1, expr2)]
          perform_sigm_times_exp(trees[0])
          trees[0] = simplify_mul(trees[0])
          good = theano.gof.graph.is_same_graph(
              compute_mul(trees[0]), compute_mul(trees[1])
          )
          if not good:
              print(trees[0])
              print(trees[1])
              print("***")
              theano.printing.debugprint(compute_mul(trees[0]))
              print("***")
              theano.printing.debugprint(compute_mul(trees[1]))
          assert good
  
      ok(sigmoid(x) * exp(-x), sigmoid(-x))
      ok(
          -x * sigmoid(x) * (y * (-1 * z) * exp(-x)),
          -x * sigmoid(-x) * (y * (-1 * z)),
      )
      ok(
          -sigmoid(-x)
          * (
              exp(y)
              * (-exp(-z) * 3 * -exp(x))
              * (y * 2 * (-sigmoid(-y) * (z + t) * exp(z)) * sigmoid(z))
          )
          * -sigmoid(x),
          sigmoid(x)
          * (
              -sigmoid(y)
              * (-sigmoid(-z) * 3)
              * (y * 2 * ((z + t) * exp(z)))
          )
          * (-sigmoid(x)),
      )
      ok(
          exp(-x) * -exp(-x) * (-sigmoid(x) * -sigmoid(x)),
          -sigmoid(-x) * sigmoid(-x),
      )
      ok(-exp(x) * -sigmoid(-x) * -exp(-x), -sigmoid(-x))
  
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 5 for calling the T_sigmoid_opts obj's underlying member method code with example usage: obj.test_perform_sigm_times_exp() without return types