提交 a963ce9c authored 作者: Guillaume Desjardins's avatar Guillaume Desjardins

Moved initialization of RandomStreams member variables to __init__

上级 939a245d
...@@ -35,27 +35,9 @@ def randomstate_constructor(value, name=None, strict=False, ...@@ -35,27 +35,9 @@ def randomstate_constructor(value, name=None, strict=False,
class RandomStreams(raw_random.RandomStreamsBase): class RandomStreams(raw_random.RandomStreamsBase):
"""Module component with similar interface to numpy.random
(numpy.random.RandomState)
"""
state_updates = []
"""A list of pairs of the form (input_r, output_r). This will be
over-ridden by the module instance to contain stream
generators.
""" """
Module component with similar interface to numpy.random
default_instance_seed = None (numpy.random.RandomState)
"""Instance variable should take None or integer value. Used to
seed the random number generator that provides seeds for member
streams
"""
gen_seedgen = None
"""numpy.RandomState instance that gen() uses to seed new streams.
""" """
def updates(self): def updates(self):
...@@ -71,8 +53,13 @@ class RandomStreams(raw_random.RandomStreamsBase): ...@@ -71,8 +53,13 @@ class RandomStreams(raw_random.RandomStreamsBase):
""" """
super(RandomStreams, self).__init__() super(RandomStreams, self).__init__()
# A list of pairs of the form (input_r, output_r). This will be
# over-ridden by the module instance to contain stream generators.
self.state_updates = [] self.state_updates = []
# Instance variable should take None or integer value. Used to seed the
# random number generator that provides seeds for member streams.
self.default_instance_seed = seed self.default_instance_seed = seed
# numpy.RandomState instance that gen() uses to seed new streams.
self.gen_seedgen = numpy.random.RandomState(seed) self.gen_seedgen = numpy.random.RandomState(seed)
def seed(self, seed=None): def seed(self, seed=None):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论