提交 7f4b36c6 authored 作者: Bart van Merrienboer's avatar Bart van Merrienboer

Add weakref to random state to distinguish them from other shared variables

上级 3fcaaf14
......@@ -6,6 +6,7 @@ http://www.iro.umontreal.ca/~simardr/ssj/indexe.html
"""
import warnings
import weakref
import numpy
......@@ -1220,6 +1221,8 @@ class MRG_RandomStreams(object):
u = self.pretty_return(node_rstate,
*mrg_uniform.new(node_rstate,
ndim, dtype, size))
# Add a reference to distinguish from other shared variables
node_rstate.rng_owner = weakref.ref(self)
r = u * (high - low) + low
if u.type.broadcastable != r.type.broadcastable:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论