提交 5dd41d9b authored 作者: ChienliMa's avatar ChienliMa

Delete copy of SharedVariable's storage, for they should have same value among different function

上级 52a7a4da
...@@ -589,9 +589,6 @@ class Function(object): ...@@ -589,9 +589,6 @@ class Function(object):
# Copy Ins and their storage. # Copy Ins and their storage.
# so that they have different storage as their value # so that they have different storage as their value
ins = [copy.copy(input) for input in maker.inputs] ins = [copy.copy(input) for input in maker.inputs]
for in_cpy, in_ori in zip(ins, maker.inputs):
if in_ori.mutable:
in_cpy.value = copy.deepcopy(in_ori.value)
# Delete update output in fgraph and updates In instances if needed # Delete update output in fgraph and updates In instances if needed
if delete_updates: if delete_updates:
......
...@@ -268,13 +268,6 @@ class T_function(unittest.TestCase): ...@@ -268,13 +268,6 @@ class T_function(unittest.TestCase):
if key not in i_o_variables or isinstance(key, theano.tensor.Constant): if key not in i_o_variables or isinstance(key, theano.tensor.Constant):
self.assertTrue(any([ storage is s for s in ori_storages])) 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):
if input.mutable:
self.assertFalse(here.data is there.data)
def test_swap_SharedVariable(self): def test_swap_SharedVariable(self):
x = T.fscalar('x') x = T.fscalar('x')
# SharedVariable for tests, one of them has update # SharedVariable for tests, one of them has update
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论