Skip to content

Commit fdbdede

Browse files
committed
Fix scan import and use at another place
1 parent 078126a commit fdbdede

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pylearn2/scripts/dbm/dbm_metrics.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import theano
3939
import theano.tensor as T
4040
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
41-
from theano.sandbox.scan import scan
41+
from theano import scan
4242

4343
import pylearn2
4444
from pylearn2.compat import OrderedDict
@@ -482,9 +482,6 @@ def _e_step(psamples, W_list, b_list, n_steps=100, eps=1e-5):
482482
"""
483483
depth = len(psamples)
484484

485-
new_psamples = [T.unbroadcast(T.shape_padleft(psample))
486-
for psample in psamples]
487-
488485
# now alternate mean-field inference for even/odd layers
489486
def mf_iteration(*psamples):
490487
new_psamples = [p for p in psamples]
@@ -502,11 +499,11 @@ def mf_iteration(*psamples):
502499

503500
new_psamples, updates = scan(
504501
mf_iteration,
505-
states=new_psamples,
502+
outputs_info=psamples,
506503
n_steps=n_steps
507504
)
508505

509-
return [x[0] for x in new_psamples]
506+
return [x[-1] for x in new_psamples]
510507

511508

512509
def estimate_likelihood(W_list, b_list, trainset, testset, free_energy_fn=None,

0 commit comments

Comments
 (0)