code: def sample_hidden_from_visible(self, visible):
          
          hprobs = tf.nn.sigmoid(tf.add(tf.matmul(visible, self.W), self.bh_))
          hstates = utilities.sample_prob(hprobs, self.hrand)
  
          return hprobs, hstates
docs: Sample the hidden units from the visible units.
  
          This is the Positive phase of the Contrastive Divergence algorithm.
  
          :param visible: activations of the visible units
          :return: tuple(hidden probabilities, hidden binary states)