fixed test_mat_reciprocal unittest (seed issue) + merge

上级 45881a7d
...@@ -184,7 +184,6 @@ boilerplate code. ...@@ -184,7 +184,6 @@ boilerplate code.
All we need to do to use this mechanism is to give a method called All we need to do to use this mechanism is to give a method called
``_instance_print_state`` to our Module class. ``_instance_print_state`` to our Module class.
.. literalinclude:: ../examples/module/mechanism1.py
Any method called like ``_instance_XXX`` will cause the object Any method called like ``_instance_XXX`` will cause the object
obtained through a call to ``make`` to have a method called ``XXX``. obtained through a call to ``make`` to have a method called ``XXX``.
...@@ -204,7 +203,6 @@ If a number of instance methods are going to be defined, and especially if you ...@@ -204,7 +203,6 @@ If a number of instance methods are going to be defined, and especially if you
will want to inherit from the kind of class that gets instantiated by make, will want to inherit from the kind of class that gets instantiated by make,
you might prefer to consider using the InstanceType mechanism. you might prefer to consider using the InstanceType mechanism.
.. literalinclude:: ../examples/module/mechanism2.py
Adding custom initialization Adding custom initialization
============================ ============================
...@@ -221,7 +219,6 @@ can override the default with your own method, which has to be called ...@@ -221,7 +219,6 @@ can override the default with your own method, which has to be called
Here is an example where we take width and height arguments to Here is an example where we take width and height arguments to
initialize a state with a matrix of zeros: initialize a state with a matrix of zeros:
.. literalinclude:: ../examples/module/accumulator.py
Nesting Modules Nesting Modules
...@@ -231,7 +228,6 @@ Probably the most powerful feature of theano's modules is that one can be ...@@ -231,7 +228,6 @@ Probably the most powerful feature of theano's modules is that one can be
included as an attribute to another so that the storage of each is available included as an attribute to another so that the storage of each is available
to both. to both.
.. literalinclude:: ../examples/module/nested.py
As you read through examples of Theano code, you will probably see many As you read through examples of Theano code, you will probably see many
instances of Modules being nested in this way. instances of Modules being nested in this way.
...@@ -108,13 +108,6 @@ automatic code generation, but that way is much, much slower. ...@@ -108,13 +108,6 @@ automatic code generation, but that way is much, much slower.
Omitting this variable defaults the mode to 'FAST_RUN'. Omitting this variable defaults the mode to 'FAST_RUN'.
- `THEANO_UNITTEST_SEED`:
An integer value specifying which seed should be used when
running unit tests. If this variable is not defined, the seed will default
to 666. Users wishing for non-deterministic behaviour can set this
variable to 'random'.
Mac Mac
--- ---
......
...@@ -1305,6 +1305,9 @@ class test_matinv(unittest.TestCase): ...@@ -1305,6 +1305,9 @@ class test_matinv(unittest.TestCase):
# and none of the dimensions are constrained to have length 1. # and none of the dimensions are constrained to have length 1.
# Note that TensorType's constructor does not actually allocate any memory. # Note that TensorType's constructor does not actually allocate any memory.
# TODO: Make TensorType syntax more explicit, and maybe give shape or number of dimensions. # TODO: Make TensorType syntax more explicit, and maybe give shape or number of dimensions.
unittest_tools.seed_rng()
a, b = matrices('ab') a, b = matrices('ab')
ab = a*b ab = a*b
# Here, as_tensor_variable actually uses the data allocated by numpy. # Here, as_tensor_variable actually uses the data allocated by numpy.
...@@ -1334,7 +1337,7 @@ class test_matinv(unittest.TestCase): ...@@ -1334,7 +1337,7 @@ class test_matinv(unittest.TestCase):
"""Matrix reciprocal by gradient descent""" """Matrix reciprocal by gradient descent"""
ssd0,ssd = self.mat_reciprocal(3) ssd0,ssd = self.mat_reciprocal(3)
numpy.random.seed(unittest_tools.fetch_seed(1)) unittest_tools.seed_rng()
# hand-coded numpy implementation for verification # hand-coded numpy implementation for verification
x = numpy.random.rand(3,3)+0.1 x = numpy.random.rand(3,3)+0.1
w = numpy.random.rand(3,3) w = numpy.random.rand(3,3)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论