code: def test_copy_share_memory(self):
      x = T.fscalar("x")
      # SharedVariable for tests, one of them has update
      y = theano.shared(value=1)
      z = theano.shared(value=2)
      out = T.tanh((x + y + 2) / (x + z - 0.2) ** 2)
  
      # Test for different linkers
      for mode in ["FAST_RUN", "FAST_COMPILE"]:
          ori = theano.function(
              [x], [out], mode=mode, updates={z: z + 1}
          )
          cpy = ori.copy(share_memory=True)
  
          # Test if memories shared
          storage_map_ori = ori.fn.storage_map
          storage_map_cpy = cpy.fn.storage_map
          fgraph_cpy = cpy.maker.fgraph
  
          # Assert intermediate and Constants storages are shared.
          # and output stoarges are not shared
          i_o_variables = fgraph_cpy.inputs + fgraph_cpy.outputs
          ori_storages = storage_map_ori.values()
          l = [
              val
              for key, val in storage_map_cpy.items()
              if key not in i_o_variables
              or isinstance(key, theano.tensor.Constant)
          ]
          for storage in l:
              self.assertTrue(any([storage is s for s in ori_storages]))
  
          # Assert storages of SharedVariable without updates are shared
          for (input, _1, _2), here, there in zip(
              ori.indices, ori.input_storage, cpy.input_storage
          ):
              self.assertTrue(here.data is there.data)
  
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 16 for calling the T_function obj's underlying member method code with example usage: obj.test_copy_share_memory() without return types