@@ -754,7 +754,8 @@ been shown to lead to a better generative model ([Tieleman08]_).
754754 # Plot filters after each training epoch
755755 plotting_start = time.clock()
756756 # Construct image from the weight matrix
757- image = PIL.Image.fromarray(tile_raster_images( X = rbm.W.value.T,
757+ image = PIL.Image.fromarray(tile_raster_images(
758+ X = rbm.W.get_value(borrow=True).T,
758759 img_shape = (28,28),tile_shape = (10,10),
759760 tile_spacing=(1,1)))
760761 image.save('filters_at_epoch_%i.png'%epoch)
@@ -781,11 +782,13 @@ each plotting.
781782 #################################
782783
783784 # find out the number of test samples
784- number_of_test_samples = test_set_x.value .shape[0]
785+ number_of_test_samples = test_set_x.get_value(borrow=True) .shape[0]
785786
786787 # pick random test examples, with which to initialize the persistent chain
787788 test_idx = rng.randint(number_of_test_samples-20)
788- persistent_vis_chain = theano.shared(test_set_x.value[test_idx:test_idx+20])
789+ persistent_vis_chain = theano.shared(numpy.asarray(
790+ test_set_x.get_value(borrow=True)[test_idx:test_idx+20],
791+ dtype=theano.config.floatX))
789792
790793Next we create the 20 persistent chains in parallel to get our
791794samples. To do so, we compile a theano function which performs one Gibbs step
@@ -797,12 +800,13 @@ samples at every 1000 steps.
797800
798801
799802 # find out the number of test
800- number_of_test_samples = test_set_x.value .shape[0]
803+ number_of_test_samples = test_set_x.get_value(borrow=True) .shape[0]
801804
802805 # pick random test examples, with which to initialize the persistent chain
803806 test_idx = rng.randint(number_of_test_samples-n_chains)
804- persistent_vis_chain = theano.shared(
805- numpy.array(test_set_x.value[test_idx:test_idx+100], dtype=theano.config.floatX))
807+ persistent_vis_chain = theano.shared(numpy.array(
808+ test_set_x.get_value(borrow=True)[test_idx:test_idx+100],
809+ dtype=theano.config.floatX))
806810
807811 plot_every = 1000
808812 # define one step of Gibbs sampling (mf = mean-field)
0 commit comments