提交 4e04ed1e authored 作者: carriepl's avatar carriepl

Make cython backend work with mode=FAST_COMPILE

上级 b0d2b83c
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -382,7 +382,7 @@ def perform( ...@@ -382,7 +382,7 @@ def perform(
else: else:
old_input_data[idx] = None old_input_data[idx] = None
# 5. compute outputs # 5.0.1 compute outputs
t0_fn = time.time() t0_fn = time.time()
try: try:
...@@ -403,8 +403,20 @@ def perform( ...@@ -403,8 +403,20 @@ def perform(
pdx = offset + n_shared_outs pdx = offset + n_shared_outs
cond = output_storage[pdx].storage[0] == 0 cond = output_storage[pdx].storage[0] == 0
# Check which of the pre-allocated outputs (if applicable) have # 5.0.2. By calling fn() directly instead of calling the theano
# been reused by the inner function # 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 range(len_output_storage): for idx in range(len_output_storage):
# If the storage map does not contain the same object, then # If the storage map does not contain the same object, then
# the pre-allocated output has not been reused # the pre-allocated output has not been reused
...@@ -426,8 +438,8 @@ def perform( ...@@ -426,8 +438,8 @@ def perform(
else: else:
output_reused[idx] = False output_reused[idx] = False
# Check which of the input storage have been modified by the inner # 5.0.4. Check which of the input storage have been modified by the
# function # inner function
for idx in xrange(len(input_storage)): for idx in xrange(len(input_storage)):
# If the storage map does not contain the same object, then # If the storage map does not contain the same object, then
# the pre-allocated output has not been reused # the pre-allocated output has not been reused
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论