提交 396211cb authored 作者: Razvan Pascanu's avatar Razvan Pascanu

I think Constants should always be cloned ( if no extra memory is used), to

ensure they don't belong to a different env.
上级 6626f485
...@@ -105,9 +105,9 @@ def rebuild_collect_shared( outputs ...@@ -105,9 +105,9 @@ def rebuild_collect_shared( outputs
, (v, v.type, v_update, v_update.type)) , (v, v.type, v_update, v_update.type))
update_d[v] = v_update update_d[v] = v_update
update_expr.append((v, v_update)) update_expr.append((v, v_update))
if not copy_inputs_over and not isinstance(v, Constant): if not copy_inputs_over or isinstance(v, Constant):
### Cloning shared variables implies copying their underlying ### Cloning shared variables implies copying their underlying
### memory buffer ?? ### memory buffer ?? No.
return clone_d.setdefault(v,v.clone()) return clone_d.setdefault(v,v.clone())
else: else:
return clone_d.setdefault(v,v) return clone_d.setdefault(v,v)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论