Mercurial > pylearn
changeset 1512:7f166d01bf8e
Remove deprecation warning.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Mon, 12 Sep 2011 11:59:55 -0400 |
parents | 9ffe5d6faee3 |
children | 2b3cff882382 |
files | pylearn/algorithms/tests/test_mcRBM.py |
diffstat | 1 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/algorithms/tests/test_mcRBM.py Mon Sep 12 11:47:23 2011 -0400 +++ b/pylearn/algorithms/tests/test_mcRBM.py Mon Sep 12 11:59:55 2011 -0400 @@ -135,8 +135,8 @@ last_epoch = epoch if as_unittest and epoch == 5: - U = rbm.U.value - W = rbm.W.value + U = rbm.U.get_value(borrow=True) + W = rbm.W.get_value(borrow=True) def allclose(a,b): return numpy.allclose(a,b,rtol=1.01,atol=1e-3) print "" @@ -168,25 +168,25 @@ print 'saving samples', jj, 'epoch', jj/(epoch_size/batchsize) - print 'l2(U)', l2(rbm.U.value), - print 'l2(W)', l2(rbm.W.value), + print 'l2(U)', l2(rbm.U.get_value(borrow=True)), + print 'l2(W)', l2(rbm.W.get_value(borrow=True)), print 'l1_penalty', try: - print trainer.effective_l1_penalty.value + print trainer.effective_l1_penalty.get_value(borrow=True) except: print trainer.effective_l1_penalty - print 'U min max', rbm.U.value.min(), rbm.U.value.max(), - print 'W min max', rbm.W.value.min(), rbm.W.value.max(), - print 'a min max', rbm.a.value.min(), rbm.a.value.max(), - print 'b min max', rbm.b.value.min(), rbm.b.value.max(), - print 'c min max', rbm.c.value.min(), rbm.c.value.max() + print 'U min max', rbm.U.get_value(borrow=True).min(), rbm.U.get_value(borrow=True).max(), + print 'W min max', rbm.W.get_value(borrow=True).min(), rbm.W.get_value(borrow=True).max(), + print 'a min max', rbm.a.get_value(borrow=True).min(), rbm.a.get_value(borrow=True).max(), + print 'b min max', rbm.b.get_value(borrow=True).min(), rbm.b.get_value(borrow=True).max(), + print 'c min max', rbm.c.get_value(borrow=True).min(), rbm.c.get_value(borrow=True).max() if persistent_chains: - print 'parts min', smplr.positions.value.min(), - print 'max',smplr.positions.value.max(), - print 'HMC step', smplr.stepsize.value, - print 'arate', smplr.avg_acceptance_rate.value + print 'parts min', smplr.positions.get_value(borrow=True).min(), + print 'max',smplr.positions.get_value(borrow=True).max(), + print 'HMC step', smplr.stepsize.get_value(borrow=True), + print 'arate', smplr.avg_acceptance_rate.get_value(borrow=True) l2_of_Ugrad = learn_fn(jj) @@ -275,24 +275,24 @@ print 'saving samples', ii, 'epoch', i_epoch, i_batch - print 'l2(U)', l2(rbm.U.value), - print 'l2(W)', l2(rbm.W.value), + print 'l2(U)', l2(rbm.U.get_value(borrow=True)), + print 'l2(W)', l2(rbm.W.get_value(borrow=True)), print 'l1_penalty', try: - print trainer.effective_l1_penalty.value + print trainer.effective_l1_penalty.get_value(borrow=True) except: print trainer.effective_l1_penalty - print 'U min max', rbm.U.value.min(), rbm.U.value.max(), - print 'W min max', rbm.W.value.min(), rbm.W.value.max(), - print 'a min max', rbm.a.value.min(), rbm.a.value.max(), - print 'b min max', rbm.b.value.min(), rbm.b.value.max(), - print 'c min max', rbm.c.value.min(), rbm.c.value.max() + print 'U min max', rbm.U.get_value(borrow=True).min(), rbm.U.get_value(borrow=True).max(), + print 'W min max', rbm.W.get_value(borrow=True).min(), rbm.W.get_value(borrow=True).max(), + print 'a min max', rbm.a.get_value(borrow=True).min(), rbm.a.get_value(borrow=True).max(), + print 'b min max', rbm.b.get_value(borrow=True).min(), rbm.b.get_value(borrow=True).max(), + print 'c min max', rbm.c.get_value(borrow=True).min(), rbm.c.get_value(borrow=True).max() - print 'HMC step', smplr.stepsize.value, - print 'arate', smplr.avg_acceptance_rate.value - print 'P min max', rbm.P.value.min(), rbm.P.value.max(), - print 'P_lr', trainer.p_lr.value + print 'HMC step', smplr.stepsize.get_value(borrow=True), + print 'arate', smplr.avg_acceptance_rate.get_value(borrow=True) + print 'P min max', rbm.P.get_value(borrow=True).min(), rbm.P.get_value(borrow=True).max(), + print 'P_lr', trainer.p_lr.get_value(borrow=True) print '' print 'Saving rbm...' cPickle.dump(rbm, open('mcRBM.rbm.%06i.pkl'%ii, 'w'), -1)