提交 7c2223fb authored 作者: ChienliMa's avatar ChienliMa

minor modification in test_function_module.py

上级 32a83c07
...@@ -247,7 +247,7 @@ class T_function(unittest.TestCase): ...@@ -247,7 +247,7 @@ class T_function(unittest.TestCase):
# test for PerformaLinker, will cover VM_linker later # test for PerformaLinker, will cover VM_linker later
ori = theano.function([x], [y], mode="FAST_COMPILE") ori = theano.function([x], [y], mode="FAST_COMPILE")
cpy = func.copy(share_memory=True) cpy = ori.copy(share_memory=True)
# test if memories shared # test if memories shared
storage_map_ori = ori.fn.storage_map storage_map_ori = ori.fn.storage_map
...@@ -258,9 +258,12 @@ class T_function(unittest.TestCase): ...@@ -258,9 +258,12 @@ class T_function(unittest.TestCase):
# assert intermediate and Constants storages are shared # assert intermediate and Constants storages are shared
i_o_variables = fgraph_cpy.inputs i_o_variables = fgraph_cpy.inputs
ori_storages = storage_map_ori.values() ori_storages = storage_map_ori.values()
for key in storage_map_cpy.keys() for key in storage_map_cpy.keys():
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(storage_map_cpy[key] in ori_storages) print key
storage = storage_map_cpy[key]
print [ 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 # assert storages of SharedVariable without updates are shared
for (input, _1, _2), here, there in zip(ori.indices, for (input, _1, _2), here, there in zip(ori.indices,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论