提交 01f73fcc authored 作者: Razvan Pascanu's avatar Razvan Pascanu

reduce, foldl and foldr will make now only a soft recomandetaion to the

optimizer to use a limited amount of memory instead of forcing scan to do that. This way you can compute gradients through reduce, foldl and flodr as well.
上级 c7dbe3db
...@@ -118,10 +118,9 @@ def reduce( fn ...@@ -118,10 +118,9 @@ def reduce( fn
if not isinstance(out_info, dict): if not isinstance(out_info, dict):
# Specifies that it should return only the last step. # Specifies that it should return only the last step.
outs_info[i] = dict( outs_info[i] = dict(
initial = out_info, return_steps = 1, store_steps = 1) initial = out_info, return_steps = 1)
else: else:
# Specifies that it should return only the last step. # Specifies that it should return only the last step.
outs_info[i]['store_steps'] = 1
outs_info[i]['return_steps'] = 1 outs_info[i]['return_steps'] = 1
# NOTE : If the user asks for more then the last step, # NOTE : If the user asks for more then the last step,
# it means he does not understand ``reduce``. We could # it means he does not understand ``reduce``. We could
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论