# Path: autograd/scipy/special.py
# def make_gammainc_vjp_arg1(sign):
#     def gammainc_vjp_arg1(ans, a, x):
# def make_grad_logsumexp(ans, x, axis=None, b=1.0, keepdims=False):
#     def vjp(g):
# def fwd_grad_logsumexp(g, ans, x, axis=None, b=1.0, keepdims=False):
# 
# Path: autograd/extend.py



import scipy.stats
import autograd.numpy as np
from autograd.scipy.special import digamma
from autograd.extend import primitive, defvjp
from __future__ import absolute_import


rvs    = primitive(scipy.stats.dirichlet.rvs)
pdf    = primitive(scipy.stats.dirichlet.pdf)
logpdf = primitive(scipy.stats.dirichlet.logpdf)

defvjp(logpdf,lambda ans, x, alpha: lambda g:
              g * (alpha - 1) / x,
              lambda ans, x, alpha: lambda g:

# Path: autograd/scipy/special.py
# def make_gammainc_vjp_arg1(sign):
#     def gammainc_vjp_arg1(ans, a, x):
# def make_grad_logsumexp(ans, x, axis=None, b=1.0, keepdims=False):
#     def vjp(g):
# def fwd_grad_logsumexp(g, ans, x, axis=None, b=1.0, keepdims=False):
# 
# Path: autograd/extend.py



# Path: autograd/scipy/stats/dirichlet.py
import scipy.stats
import autograd.numpy as np
from autograd.scipy.special import digamma
from autograd.extend import primitive, defvjp

from __future__ import absolute_import


rvs    = primitive(scipy.stats.dirichlet.rvs)
pdf    = primitive(scipy.stats.dirichlet.pdf)
logpdf = primitive(scipy.stats.dirichlet.logpdf)

defvjp(logpdf,lambda ans, x, alpha: lambda g:
              g * (alpha - 1) / x,
              lambda ans, x, alpha: lambda g:

              g * (digamma(np.sum(alpha)) - digamma(alpha) + np.log(x)))