human
Complete the below
def MvNormalLogp():

    ''''Compute the log pdf of a multivariate normal distribution.
    This should be used in MvNormal.logp once Theano#5908 is released.
    Parameters
    cov : tt.matrix
    The covariance matrix.
    delta : tt.matrix
    Array of deviations from the mean.'
    '''

Can you provide a Python code to compute the log pdf of a multivariate normal distribution?
assistant
#Here is Python code to compute the log pdf of a multivariate normal distribution.
    cov = tt.matrix('cov')
    cov.tag.test_value = floatX(np.eye(3))
    delta = tt.matrix('delta')
    delta.tag.test_value = floatX(np.zeros((2, 3)))
    solve_lower = tt.slinalg.Solve(A_structure='lower_triangular')
    solve_upper = tt.slinalg.Solve(A_structure='upper_triangular')
    cholesky = Cholesky(nofail=True, lower=True)
    (n, k) = delta.shape
    (n, k) = (f(n), f(k))
    chol_cov = cholesky(cov)
    diag = tt.nlinalg.diag(chol_cov)
    ok = tt.all((diag > 0))
    chol_cov = tt.switch(ok, chol_cov, tt.fill(chol_cov, 1))
    delta_trans = solve_lower(chol_cov, delta.T).T
    result = ((n * k) * tt.log((f(2) * np.pi)))
    result += ((f(2) * n) * tt.sum(tt.log(diag)))
    result += (delta_trans ** f(2)).sum()
    result = (f((-0.5)) * result)
    logp = tt.switch(ok, result, (- np.inf))
    def dlogp(inputs, gradients):
        (g_logp,) = gradients
        (cov, delta) = inputs
        g_logp.tag.test_value = floatX(1.0)
        (n, k) = delta.shape
        chol_cov = cholesky(cov)
        diag = tt.nlinalg.diag(chol_cov)
        ok = tt.all((diag > 0))
        chol_cov = tt.switch(ok, chol_cov, tt.fill(chol_cov, 1))
        delta_trans = solve_lower(chol_cov, delta.T).T
        inner = ((n * tt.eye(k)) - tt.dot(delta_trans.T, delta_trans))
        g_cov = solve_upper(chol_cov.T, inner)
        g_cov = solve_upper(chol_cov.T, g_cov.T)
        tau_delta = solve_upper(chol_cov.T, delta_trans.T)
        g_delta = tau_delta.T
        g_cov = tt.switch(ok, g_cov, (- np.nan))
        g_delta = tt.switch(ok, g_delta, (- np.nan))
        return [(((-0.5) * g_cov) * g_logp), ((- g_delta) * g_logp)]
    return theano.OpFromGraph([cov, delta], [logp], grad_overrides=dlogp, inline=True)