code: def test_cpu_target_with_shared_variable():
      srng = MRG_RandomStreams()
      s = np.random.rand(2, 3).astype("float32")
      x = gpuarray_shared_constructor(s, name="x")
      try:
          # To have theano.shared(x) try to move on the GPU
          theano.compile.shared_constructor(gpuarray_shared_constructor)
          y = srng.uniform(x.shape, target="cpu")
          y.name = "y"
          z = (x * y).sum()
          z.name = "z"
  
          fz = theano.function([], z, mode=mode)
  
          nodes = fz.maker.fgraph.toposort()
          assert not any(
              [isinstance(node.op, GPUA_mrg_uniform) for node in nodes]
          )
      finally:
          theano.compile.shared_constructor(
              gpuarray_shared_constructor, remove=True
          )
  
file_path: Theano/theano/gpuarray/tests/test_rng_mrg.py
imports: from __future__ import absolute_import, print_function, division
  import functools
  import numpy
  import theano
  from theano import change_flags, tensor
  from theano.sandbox import rng_mrg
  from theano.sandbox.rng_mrg import MRG_RandomStreams
  from theano.sandbox.tests.test_rng_mrg import java_samples, rng_mrg_overflow
  from theano.sandbox.tests.test_rng_mrg import test_f16_nonzero
  from theano.tests import unittest_tools
  from .config import mode_with_gpu
  from ..type import gpuarray_shared_constructor
  from ..rng_mrg import GPUA_mrg_uniform
label_desc: Use image node_id 7 for calling a global function with example usage: test_cpu_target_with_shared_variable() without return types