code: def sample_prob(probs, rand):
      
      return tf.nn.relu(tf.sign(probs - rand))
docs: Get samples from a tensor of probabilities.
  
      :param probs: tensor of probabilities
      :param rand: tensor (of the same shape as probs) of random values
      :return: binary sample of probabilities