(x, mean, var)
return 0.5 * torch.sum(-torch.log(2.0 * pi) - torch.log(var) - ((x - mean).pow(2) / var), dim=1)
Args:
        x: (Variable, FloatTensor) [batch_size, dim]
        mean: (Variable, FloatTensor) [batch_size, dim] or [batch_size] or [1]
        var: (Variable, FloatTensor) [batch_size, dim]: positive value
    Return:
        log_p: (Variable, FloatTensor) [batch_size]
Args:
        x: (Variable, FloatTensor) [batch_size, dim]
        mean: (Variable, FloatTensor) [batch_size, dim] or [batch_size] or [1]
        var: (Variable, FloatTensor) [batch_size, dim]: positive value
    Return:
        log_p: (Variable, FloatTensor) [batch_size]
Args : x : ( Variable FloatTensor ) [ batch_size dim ] mean : ( Variable FloatTensor ) [ batch_size dim ] or [ batch_size ] or [ 1 ] var : ( Variable FloatTensor ) [ batch_size dim ] : positive value Return : log_p : ( Variable FloatTensor ) [ batch_size ]
def normal_logpdf(x, mean, var):
    """
    Args:
        x: (Variable, FloatTensor) [batch_size, dim]
        mean: (Variable, FloatTensor) [batch_size, dim] or [batch_size] or [1]
        var: (Variable, FloatTensor) [batch_size, dim]: positive value
    Return:
        log_p: (Variable, FloatTensor) [batch_size]
    """

    pi = to_var(torch.FloatTensor([np.pi]))
    return 0.5 * torch.sum(-torch.log(2.0 * pi) - torch.log(var) - ((x - mean).pow(2) / var), dim=1)
def normal_logpdf ( x , mean , var ) : pi = to_var ( torch . FloatTensor ( [ np . pi ] ) ) return 0.5 * torch . sum ( - torch . log ( 2.0 * pi ) - torch . log ( var ) - ( ( x - mean ) . pow ( 2 ) / var ) , dim = 1 )