Mercurial > pylearn
comparison pylearn/algorithms/mcRBM.py @ 1499:f82b80c841b2
Remove deprecation warning.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Fri, 09 Sep 2011 10:49:54 -0400 |
parents | 54b2268db0d7 |
children | 517f4c02dde9 |
comparison
equal
deleted
inserted
replaced
1498:0f326860210e | 1499:f82b80c841b2 |
---|---|
373 For an RBM made from shared variables, this will return an integer, | 373 For an RBM made from shared variables, this will return an integer, |
374 for a purely symbolic RBM this will return a theano expression. | 374 for a purely symbolic RBM this will return a theano expression. |
375 | 375 |
376 """ | 376 """ |
377 try: | 377 try: |
378 return self.W.value.shape[0] | 378 return self.W.get_value(borrow=True, return_internal_type=True).shape[0] |
379 except AttributeError: | 379 except AttributeError: |
380 return self.W.shape[0] | 380 return self.W.shape[0] |
381 | 381 |
382 def n_hidden_cov_units(self): | 382 def n_hidden_cov_units(self): |
383 """Return the number of hidden units for the covariance in this RBM | 383 """Return the number of hidden units for the covariance in this RBM |
385 For an RBM made from shared variables, this will return an integer, | 385 For an RBM made from shared variables, this will return an integer, |
386 for a purely symbolic RBM this will return a theano expression. | 386 for a purely symbolic RBM this will return a theano expression. |
387 | 387 |
388 """ | 388 """ |
389 try: | 389 try: |
390 return self.U.value.shape[1] | 390 return self.U.get_value(borrow=True, return_internal_type=True).shape[1] |
391 except AttributeError: | 391 except AttributeError: |
392 return self.U.shape[1] | 392 return self.U.shape[1] |
393 | 393 |
394 def n_hidden_mean_units(self): | 394 def n_hidden_mean_units(self): |
395 """Return the number of hidden units for the mean in this RBM | 395 """Return the number of hidden units for the mean in this RBM |
397 For an RBM made from shared variables, this will return an integer, | 397 For an RBM made from shared variables, this will return an integer, |
398 for a purely symbolic RBM this will return a theano expression. | 398 for a purely symbolic RBM this will return a theano expression. |
399 | 399 |
400 """ | 400 """ |
401 try: | 401 try: |
402 return self.W.value.shape[1] | 402 return self.W.get_value(borrow=True, return_internal_type=True).shape[1] |
403 except AttributeError: | 403 except AttributeError: |
404 return self.W.shape[1] | 404 return self.W.shape[1] |
405 | 405 |
406 def CD1_sampler(self, v, n_particles, n_visible=None, rng=8923984): | 406 def CD1_sampler(self, v, n_particles, n_visible=None, rng=8923984): |
407 """Return a symbolic negative-phase particle obtained by simulating the Hamiltonian | 407 """Return a symbolic negative-phase particle obtained by simulating the Hamiltonian |
578 For an RBM made from shared variables, this will return an integer, | 578 For an RBM made from shared variables, this will return an integer, |
579 for a purely symbolic RBM this will return a theano expression. | 579 for a purely symbolic RBM this will return a theano expression. |
580 | 580 |
581 """ | 581 """ |
582 try: | 582 try: |
583 return self.P.value.shape[1] | 583 return self.P.get_value(borrow=True, return_internal_type=True).shape[1] |
584 except AttributeError: | 584 except AttributeError: |
585 return self.P.shape[1] | 585 return self.P.shape[1] |
586 | 586 |
587 @classmethod | 587 @classmethod |
588 def alloc(cls, n_I, n_K, n_J, *args, **kwargs): | 588 def alloc(cls, n_I, n_K, n_J, *args, **kwargs): |
667 else: | 667 else: |
668 p_lr = None | 668 p_lr = None |
669 rval = cls.alloc(rbm, visible_batch, batchsize, initial_lr_per_example, rng, l1_penalty, | 669 rval = cls.alloc(rbm, visible_batch, batchsize, initial_lr_per_example, rng, l1_penalty, |
670 l1_penalty_start, learn_rate_multipliers, lr_anneal_start, persistent_chains) | 670 l1_penalty_start, learn_rate_multipliers, lr_anneal_start, persistent_chains) |
671 | 671 |
672 rval.p_mask = sharedX((rbm.P.value!=0).astype('float32'), 'p_mask') | 672 rval.p_mask = sharedX((rbm.P.get_value(borrow=True)!=0).astype('float32'), 'p_mask') |
673 | 673 |
674 rval.p_lr = p_lr | 674 rval.p_lr = p_lr |
675 rval.p_training_start=p_training_start | 675 rval.p_training_start=p_training_start |
676 rval.p_training_lr=p_training_lr | 676 rval.p_training_lr=p_training_lr |
677 return rval | 677 return rval |