This function infers state of visible units given hidden units
(self, h0_sample)
| 177 | return [pre_sigmoid_activation, T.nnet.sigmoid(pre_sigmoid_activation)] |
| 178 | |
| 179 | def sample_v_given_h(self, h0_sample): |
| 180 | ''' This function infers state of visible units given hidden units ''' |
| 181 | # compute the activation of the visible given the hidden sample |
| 182 | pre_sigmoid_v1, v1_mean = self.propdown(h0_sample) |
| 183 | # get a sample of the visible given their activation |
| 184 | # Note that theano_rng.binomial returns a symbolic sample of dtype |
| 185 | # int64 by default. If we want to keep our computations in floatX |
| 186 | # for the GPU we need to specify to return the dtype floatX |
| 187 | v1_sample = self.theano_rng.binomial(size=v1_mean.shape, |
| 188 | n=1, p=v1_mean, |
| 189 | dtype=theano.config.floatX) |
| 190 | return [pre_sigmoid_v1, v1_mean, v1_sample] |
| 191 | |
| 192 | def gibbs_hvh(self, h0_sample): |
| 193 | ''' This function implements one step of Gibbs sampling, |