提交 6396cb9f authored 作者: James Bergstra's avatar James Bergstra

Changed default value of strict to True for shared variables. This is safer

when initializing a shared variable with a value of 0 because subsequent floating-point assignments will be silently downcasted to 0. At the same time, it is slightly more annoying when it comes to float32 vs. float64 differences.
上级 6a7d9ec9
...@@ -116,7 +116,7 @@ def shared_constructor(ctor): ...@@ -116,7 +116,7 @@ def shared_constructor(ctor):
shared.constructors.append(ctor) shared.constructors.append(ctor)
return ctor return ctor
def shared(value, name=None, strict=False, **kwargs): def shared(value, name=None, strict=True, **kwargs):
"""Return a SharedVariable Variable, initialized with a copy or reference of `value`. """Return a SharedVariable Variable, initialized with a copy or reference of `value`.
This function iterates over constructor functions (see `shared_constructor`) to find a This function iterates over constructor functions (see `shared_constructor`) to find a
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论