code: def test_swap_SharedVariable_with_given(self):
      # A special testcase for logistic_sgd.py in Deep Learning Tutorial
      # This test assert that SharedVariable in different function have same storage
  
      train_x = theano.shared(
          value=np.random.rand(10, 10).astype(config.floatX)
      )
      test_x = theano.shared(
          value=np.random.rand(10, 10).astype(config.floatX)
      )
  
      train_y = theano.shared(
          value=np.random.rand(10, 1).astype(config.floatX)
      )
      test_y = theano.shared(
          value=np.random.rand(10, 1).astype(config.floatX)
      )
  
      i = T.iscalar("index")
      x = T.vector("x")
      y = T.vector("y")
      # this formular has no sense but for a test
      out = (T.sum(x) - y) ** 2
      train = theano.function(
          [i],
          out,
          givens={x: train_x[i], y: train_y[i]},
          updates={train_x: train_x + 0.1},
      )
  
      test_def = theano.function(
          [i], out, givens={x: test_x[i], y: test_y[i]}
      )
      test_cpy = train.copy(
          swap={train_x: test_x, train_y: test_y}, delete_updates=True
      )
  
      for in1, in2 in zip(test_def.maker.inputs, test_cpy.maker.inputs):
          assert in1.value is in2.value
  
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 18 for calling the T_function obj's underlying member method code with example usage: obj.test_swap_SharedVariable_with_given() without return types