提交 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:
THEANO_FLAGS='mode=FAST_RUN' nosetests
THEANO_FLAGS='mode=DEBUG_MODE' nosetests
.. _random_value_in_tests:
Using Random Values in Test Cases
---------------------------------
......
......@@ -350,24 +350,16 @@ Here is some code that allow to make the op Optional:
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
number. You can do this by seeding NumPy's randon number
generator. There is the Theano flag unittest.rseed that specify the
seed that should be used to init random number generators. There is 2
ways to do this it numpy, here is one:
generator.
.. code-block:: python
# You can set NumPy's internal random number generator state with
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 conveniance, the classes InferShapeTester and RopLop_checker
already do this for you. If you implement your own ``setUp`` function,
don't forget to call the parent ``setUp`` function.
For more details see :ref:`random_value_in_tests`.
GPU Op
------
......
......@@ -58,6 +58,7 @@ class RopLop_checker(unittest.TestCase):
Rop to class that inherit from it."""
def setUp(self):
utt.seed_rng()
# Using vectors make things a lot simpler for generating the same
# computations using scan
self.x = tensor.vector('x')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论