'Compute the log-likelihood under the distribution.
Args:
z (optional): value to compute likelihood for, if None, use sample.
Returns:
The likelihood of z under the model.'

def logp(self, z=None):

    if (z is None):
        z = self.sample
    if (z == self.sample_bxn):
        return gaussian_pos_log_likelihood(self.mean_bxn, self.logvar_bxn, self.noise_bxn)
    return diag_gaussian_log_likelihood(z, self.mean_bxn, self.logvar_bxn)
