Skip to content

Instantly share code, notes, and snippets.

@rizar
Created October 22, 2014 20:31
Show Gist options
  • Save rizar/e661d3a83e42587fe38a to your computer and use it in GitHub Desktop.
Save rizar/e661d3a83e42587fe38a to your computer and use it in GitHub Desktop.
Theano Scan Updates
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()
@rizar
Copy link
Author

rizar commented Nov 12, 2014

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