Created
June 1, 2016 14:00
-
-
Save justheuristic/a3ae56a198a51d49cb0590036deed4ab to your computer and use it in GitHub Desktop.
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 import tensor as T | |
| trng = T.shared_randomstreams.RandomStreams(1234) | |
| inner_upd = None | |
| def OneStep(vsample) : | |
| def inner(vsample): | |
| return vsample + trng.normal(size=vsample.shape) | |
| global inner_upd | |
| vsample,inner_upd = theano.scan(inner,outputs_info=vsample,n_steps=5) | |
| return vsample + trng.normal(size=vsample.shape) | |
| sample = theano.tensor.vector() | |
| values, updates = theano.scan(OneStep, outputs_info=sample, n_steps=10) | |
| fun = theano.function([sample], values[-1], | |
| #no_default_updates=True #wontwork | |
| #updates = updates+inner_upd #wontwork | |
| #updates = updates #wontwork | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment