This function infers state of hidden units given visible units
(self, v0_sample)
| 149 | return [pre_sigmoid_activation, T.nnet.sigmoid(pre_sigmoid_activation)] |
| 150 | |
| 151 | def sample_h_given_v(self, v0_sample): |
| 152 | ''' This function infers state of hidden units given visible units ''' |
| 153 | # compute the activation of the hidden units given a sample of |
| 154 | # the visibles |
| 155 | pre_sigmoid_h1, h1_mean = self.propup(v0_sample) |
| 156 | # get a sample of the hiddens given their activation |
| 157 | # Note that theano_rng.binomial returns a symbolic sample of dtype |
| 158 | # int64 by default. If we want to keep our computations in floatX |
| 159 | # for the GPU we need to specify to return the dtype floatX |
| 160 | h1_sample = self.theano_rng.binomial(size=h1_mean.shape, |
| 161 | n=1, p=h1_mean, |
| 162 | dtype=theano.config.floatX) |
| 163 | return [pre_sigmoid_h1, h1_mean, h1_sample] |
| 164 | |
| 165 | def propdown(self, hid): |
| 166 | '''This function propagates the hidden units activation downwards to |
no test coverage detected