def bernoulli_action_log_prob(logit, action):
    """Calculate the log p of an action with respect to a Bernoulli
    distribution. Use logit rather than prob for numerical stability."""
    if action == 0:
        return F.logsigmoid(-logit)
    else:
        return F.logsigmoid(logit)
Calculate the log p of an action with respect to a Bernoulli
    distribution. Use logit rather than prob for numerical stability.
tutorials/models/3_generative_model/5_dgmg.py