code: def test_optimizations_preserved(self):
      a = T.dvector()  # the a is for 'anonymous' (un-named).
      x = T.dvector("x")
      s = T.dvector("s")
      xm = T.dmatrix("x")
      sm = T.dmatrix("s")
  
      f = function(
          [a, x, s, xm, sm],
          ((a.T.T) * (tensor.dot(xm, (sm.T.T.T)) + x).T * (x / x) + s),
      )
      old_default_mode = config.mode
      old_default_opt = config.optimizer
      old_default_link = config.linker
      try:
          try:
              str_f = pickle.dumps(f, protocol=-1)
              config.mode = "Mode"
              config.linker = "py"
              config.optimizer = "None"
              g = pickle.loads(str_f)
              # print g.maker.mode
              # print compile.mode.default_mode
          except NotImplementedError as e:
              if e[0].startswith("DebugMode is not pickl"):
                  g = "ok"
      finally:
          config.mode = old_default_mode
          config.optimizer = old_default_opt
          config.linker = old_default_link
  
      if g == "ok":
          return
  
      assert f.maker is not g.maker
      assert f.maker.fgraph is not g.maker.fgraph
      tf = f.maker.fgraph.toposort()
      tg = f.maker.fgraph.toposort()
      assert len(tf) == len(tg)
      for nf, ng in zip(tf, tg):
          assert nf.op == ng.op
          assert len(nf.inputs) == len(ng.inputs)
          assert len(nf.outputs) == len(ng.outputs)
          assert [i.type for i in nf.inputs] == [
              i.type for i in ng.inputs
          ]
          assert [i.type for i in nf.outputs] == [
              i.type for i in ng.outputs
          ]
  
imports: from __future__ import absolute_import, print_function, division
  import copy
  import six.moves.cPickle
  import numpy
  import unittest
  import time
  from theano import config, gof
  from six import iteritems
  from theano.compile.io import In, Out
  from theano.compile import function
  from theano.compile import UnusedInputError
  from theano.gof import MissingInputError
  from theano.compat import exc_message
  from theano.tests.unittest_tools import SkipTest
  from theano import tensor
  from theano import tensor
  import theano
label_desc: Use image node_id 6 for calling the T_picklefunction obj's underlying member method code with example usage: obj.test_optimizations_preserved() without return types