# HG changeset patch # User Frederic Bastien # Date 1315580026 14400 # Node ID 55534951dd911adc7541aac4d5d5297237189cc6 # Parent 517f4c02dde917288112e768aa8ed8cb66e64e02 Clean up import and remove deprecation warning. diff -r 517f4c02dde9 -r 55534951dd91 pylearn/sampling/hmc.py --- 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