changeset 1501:55534951dd91

Clean up import and remove deprecation warning.
author Frederic Bastien <nouiz@nouiz.org>
date Fri, 09 Sep 2011 10:53:46 -0400
parents 517f4c02dde9
children 4fa5ebe8a7ad
files pylearn/sampling/hmc.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sampling/hmc.py	Fri Sep 09 10:50:32 2011 -0400
+++ b/pylearn/sampling/hmc.py	Fri Sep 09 10:53:46 2011 -0400
@@ -28,10 +28,7 @@
 
 
 """
-import sys
-import logging
 import numpy
-import numpy as np
 from theano import function, shared
 from theano import tensor as TT
 import theano
@@ -124,14 +121,17 @@
 
     # perform leapfrog updates: the scan op is used to repeatedly compute pos(t_1 + n*sigma) and
     # vel(t_1 + n*sigma + 1/2) for n in [0,n_steps-2].
-    (final_p, final_v), scan_updates = theano.scan(leapfrog, 
+    (all_p, all_v), scan_updates = theano.scan(leapfrog, 
             outputs_info=[
-                dict(initial=p_full_step, return_steps=1),
-                dict(initial=v_half_step, return_steps=1),
+                dict(initial=p_full_step),
+                dict(initial=v_half_step),
                 ],
             non_sequences=[stepsize],
             n_steps=n_steps-1)
 
+    final_p = all_p[-1]
+    final_v = all_v[-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