'Returns sampled random variables parameterized by log_alpha.'

def _random_sample_soft(self, log_alpha, u, layer, temperature=None):

    if (temperature is None):
        temperature = self.hparams.temperature
    x = ((log_alpha + U.safe_log_prob(u)) - U.safe_log_prob((1 - u)))
    x /= tf.expand_dims(temperature, (-1))
    if self.hparams.muprop_relaxation:
        y = tf.nn.sigmoid((x + (log_alpha * tf.expand_dims((temperature / (temperature + 1)), (-1)))))
    else:
        y = tf.nn.sigmoid(x)
    return {'preactivation': x, 'activation': y, 'log_param': log_alpha}
