提交 2348c3c2 authored 作者: Frederic Bastien's avatar Frederic Bastien

Check less inputs to compile less c code.

上级 bc170305
...@@ -438,3 +438,11 @@ def test_reallocation(): ...@@ -438,3 +438,11 @@ def test_reallocation():
assert check_storage(storage_map)[0] assert check_storage(storage_map)[0]
assert len(set(id(v) for v in assert len(set(id(v) for v in
itervalues(storage_map))) < len(storage_map) itervalues(storage_map))) < len(storage_map)
def test_no_recycling():
x = theano.tensor.vector()
mode = theano.Mode(optimizer='fast_compile')
f=theano.function([x], x+1, mode=mode)
f2=theano.function([x], (x+1)*2, mode=mode)
theano.printing.debugprint([f, f2])
...@@ -413,6 +413,9 @@ class Stack(VM): ...@@ -413,6 +413,9 @@ class Stack(VM):
self.node_executed_order = [] self.node_executed_order = []
self.node_cleared_order = [] self.node_cleared_order = []
for cont in self.pre_call_clear:
cont[0] = None
for k in self.storage_map: for k in self.storage_map:
compute_map[k][0] = (k.owner is None) compute_map[k][0] = (k.owner is None)
if self.callback_input and compute_map[k][0]: if self.callback_input and compute_map[k][0]:
...@@ -1051,7 +1054,11 @@ class VM_Linker(link.LocalLinker): ...@@ -1051,7 +1054,11 @@ class VM_Linker(link.LocalLinker):
thunks.append(node.op.make_thunk(node, thunks.append(node.op.make_thunk(node,
storage_map, storage_map,
compute_map, compute_map,
no_recycling, # The no recycling is done at the VM.__call__
# implementation at the next call with the
# pre_call_clear. So there is no need to cause
# duplicate c code by passing no_recycling here.
no_recycling=[],
impl=impl)) impl=impl))
linker_make_thunk_time[node] = time.time() - thunk_start linker_make_thunk_time[node] = time.time() - thunk_start
if not hasattr(thunks[-1], 'lazy'): if not hasattr(thunks[-1], 'lazy'):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论