提交 a7aeeba3 authored 作者: Frederic's avatar Frederic

Remove duplicate doc by linking to the second place.

Make the Rop_Checker init the rng by default.
上级 9d0c3dd2
...@@ -308,6 +308,8 @@ type this: ...@@ -308,6 +308,8 @@ type this:
THEANO_FLAGS='mode=FAST_RUN' nosetests THEANO_FLAGS='mode=FAST_RUN' nosetests
THEANO_FLAGS='mode=DEBUG_MODE' nosetests THEANO_FLAGS='mode=DEBUG_MODE' nosetests
.. _random_value_in_tests:
Using Random Values in Test Cases Using Random Values in Test Cases
--------------------------------- ---------------------------------
......
...@@ -350,24 +350,16 @@ Here is some code that allow to make the op Optional: ...@@ -350,24 +350,16 @@ Here is some code that allow to make the op Optional:
Random number in tests Random number in tests
---------------------- ----------------------
Making test errors more reproducable is a good practice. To make your Making tests errors more reproducable is a good practice. To make your
tests more reproducable, you need a way to get the same random tests more reproducable, you need a way to get the same random
number. You can do this by seeding NumPy's randon number number. You can do this by seeding NumPy's randon number
generator. There is the Theano flag unittest.rseed that specify the generator.
seed that should be used to init random number generators. There is 2
ways to do this it numpy, here is one:
.. code-block:: python For conveniance, the classes InferShapeTester and RopLop_checker
already do this for you. If you implement your own ``setUp`` function,
# You can set NumPy's internal random number generator state with don't forget to call the parent ``setUp`` function.
numpy.random.seed(utt.fetch_seed())
# All following call to numpy.random.*() function will get affected.
# Or you can create a new RandomState separate from the others
rng = numpy.random.RandomState(utt.fetch_seed())
# You can call all numpy's random number generator function's on rng
rng.rand(5, 5)
For more details see :ref:`random_value_in_tests`.
GPU Op GPU Op
------ ------
......
...@@ -58,6 +58,7 @@ class RopLop_checker(unittest.TestCase): ...@@ -58,6 +58,7 @@ class RopLop_checker(unittest.TestCase):
Rop to class that inherit from it.""" Rop to class that inherit from it."""
def setUp(self): def setUp(self):
utt.seed_rng()
# Using vectors make things a lot simpler for generating the same # Using vectors make things a lot simpler for generating the same
# computations using scan # computations using scan
self.x = tensor.vector('x') self.x = tensor.vector('x')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论