提交 b0d2b83c authored 作者: carriepl's avatar carriepl

Make python backend work with mode=FAST_COMPILE

上级 b351f47a
......@@ -1296,7 +1296,7 @@ class Scan(PureOp):
else:
old_input_data[idx] = None
# 5. compute outputs
# 5.0.1 compute outputs
t0_fn = time.time()
try:
......@@ -1325,8 +1325,20 @@ class Scan(PureOp):
pdx = offset + self.n_shared_outs
cond = output_storage[pdx].storage[0] == 0
# Check which of the pre-allocated outputs (if applicable) have
# been reused by the inner function
# 5.0.2. By calling fn() directly instead of calling the theano
# function, it is possible that the updates have not been
# performed. Perform the updates if needed.
offset_out = len(output_storage) - 1
if getattr(fn, 'need_update_inputs', True):
# Update the inputs that have an update function
for inp, storage in zip(self.fn.maker.expanded_inputs,
self.fn.input_storage)[::-1]:
if inp.update is not None:
storage.data = output_storage[offset_out].data
offset_out -= 1
# 5.0.3. Check which of the pre-allocated outputs (if applicable)
# have been reused by the inner function
for idx in xrange(len(output_storage)):
# If the storage map does not contain the same object, then
# the pre-allocated output has not been reused
......@@ -1348,8 +1360,8 @@ class Scan(PureOp):
else:
output_reused[idx] = False
# Check which of the input storage have been modified by the inner
# function
# 5.0.4 Check which of the input storage have been modified by the
# inner function
for idx in xrange(len(input_storage)):
# If the storage map does not contain the same object, then
# the pre-allocated output has not been reused
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论