code: def local_inv_1_plus_exp(node):
      """
      1/(1+exp(x)) -> sigm(-x)
  
      """
      # this optimization should be done for numerical stability
      # so we don't care to check client counts
      if node.op == tensor.inv:
          inv_arg = node.inputs[0]
          if inv_arg.owner and inv_arg.owner.op == tensor.add:
              scalars, scalar_inputs, nonconsts = opt.scalarconsts_rest(
                  inv_arg.owner.inputs, only_process_constants=True
              )
              # scalar_inputs are potentially dimshuffled and fill'd scalars
              if len(nonconsts) == 1:
                  if (
                      nonconsts[0].owner
                      and nonconsts[0].owner.op == tensor.exp
                  ):
                      if scalars and np.allclose(np.sum(scalars), 1):
                          out = opt._fill_chain(
                              sigmoid(
                                  tensor.neg(
                                      nonconsts[0].owner.inputs[0]
                                  )
                              ),
                              scalar_inputs,
                          )
                          # keep combined stack traces of
                          #     exp(x):           nonconsts[0],
                          #     1 + exp(x):       inv_arg,
                          #     1 / (1 + exp(x)): node.outputs[0]
                          copy_stack_trace(
                              [nonconsts[0], inv_arg, node.outputs[0]],
                              out,
                          )
                          return out
  
imports: from __future__ import absolute_import, print_function, division
  import warnings
  import numpy
  import theano
  from theano import config, gof, printing, scalar
  from theano.compat import imap
  from theano.printing import pprint
  from theano.tensor import basic
  from theano.tensor import elemwise, opt, NotScalarConstantError
  from theano.tensor.type import values_eq_approx_remove_inf
  from theano.gof.opt import copy_stack_trace
label_desc: Use image node_id 18 for calling a global function with example usage: local_inv_1_plus_exp(node) and returns: out