raw_random – Low-level random numbers
Enter search terms or a module, class or function name.
Platforms: Unix, Windows
Since Theano uses a functional design, producing pseudo-random numbers in a graph is not quite as straightforward as it is in numpy. If you are using Theano’s shared variables, then a RandomStreams object is probably what you want. (If you are using Module then this tutorial will be useful but not exactly what you want. Have a look at the :api:`RandomFunction` Op.)
The way to think about putting randomness into theano’s computations is to put random variables in your graph. Theano will allocate a numpy RandomState object for each such variable, and draw from it as necessary. I’ll call this sort of sequence of random numbers a random stream.
For an example of how to use random numbers, see Using Random Numbers.
This is a symbolic stand-in for numpy.random.RandomState. Random variables of various distributions are instantiated by calls to parent class raw_random.RandomStreamsBase.
| Returns: | a list of all the (state, new_state) update pairs from the random variables it has returned. |
|---|
This can be a convenient shortcut to enumerating all the random variables in a large graph in the update parameter of function.
meta_seed will be used to seed a temporary random number generator, that will in turn generate seeds for each of the random variables that has been created by this object (via gen).
| Returns: | None |
|---|
Return the random variable from op(*args, **kwargs), but also install special attributes (.rng and update, see RandomVariable ) into it.
This function also adds the returned variable to an internal list so that it can be seeded later by a call to seed.