changeset 1390:746ebceeb46f

added comments to hmc code (old outstanding changes)
author gdesjardins
date Mon, 20 Dec 2010 18:08:04 -0500
parents c82340966bf6
children 124b939d997f
files pylearn/sampling/hmc.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sampling/hmc.py	Mon Dec 20 17:59:49 2010 -0500
+++ b/pylearn/sampling/hmc.py	Mon Dec 20 18:08:04 2010 -0500
@@ -132,6 +132,12 @@
             non_sequences=[stepsize],
             n_steps=n_steps-1)
 
+    # NOTE: Scan always returns an updates dictionary, in case the scanned function draws
+    # samples from a RandomStream. These updates must then be used when compiling the Theano
+    # function, to avoid drawing the same random numbers each time the function is called. In
+    # this case however, we consciously ignore "scan_updates" because we know it is empty.
+    assert not scan_updates
+    
     # The last velocity returned by the scan op is at time-step: t + n_steps* stepsize - 1/2
     # We therefore perform one more half-step to return vel(t + n_steps*stepsize)
     energy = energy_fn(final_p)