Created
October 22, 2014 20:31
-
-
Save rizar/e661d3a83e42587fe38a to your computer and use it in GitHub Desktop.
Theano Scan Updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import theano | |
from theano.tensor.shared_randomstreams import RandomStreams | |
r = RandomStreams(1) | |
y, u = theano.scan(lambda : r.binomial(size=(2, 2)), n_steps=3) | |
f = theano.function([], [y]) | |
# It still gives me three different sequence of random matrices! | |
print f() | |
print f() | |
print f() |
Sorry, have not seen this response before. Looks like it actually gives us "better" random :)
We can attach updates
to the tag of the Apply node and find it then when exploring the computation graph.
And by the way: in a more complex situation I could not even call a compiled without updates function...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's an example which shows that passing updates gives you the correct answer, while not passing it gives you the wrong one: