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_ori = ori.maker.fgraph
            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()
            for key in storage_map_cpy.keys():
                storage = storage_map_cpy[key]
                if i_o_variables not in key or isinstance(key, theano.tensor.Constant):
                    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)
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/compile/tests/test_function_module.py/T_function.test_copy_share_memory/swapped operands of `not in`