# Path: autograd/extend.py

# 
# Path: autograd/numpy/numpy_vjps.py
# def unbroadcast_f(target, f):
#     target_meta = anp.metadata(target)
#     return lambda g: unbroadcast(f(g), target_meta)
# 
# def repeat_to_match_shape(g, shape, dtype, axis, keepdims):
#     """Returns the array g repeated along axis to fit vector space vs.
#        Also returns the number of repetitions of the array."""
#     if shape == ():
#       return g, 1
#     axis = list(axis) if isinstance(axis, tuple) else axis
#     new_shape = onp.array(shape)
#     new_shape[axis] = 1
#     num_reps = onp.prod(onp.array(shape)[axis])
#     # Can't use broadcast_to because of numpy bug: https://github.com/numpy/numpy/issues/9165
#     # return anp.broadcast_to(anp.reshape(g, new_shape), shape), num_reps
#     return anp.reshape(g, new_shape) + onp.zeros(shape, dtype=dtype), num_reps


import scipy.special
import autograd.numpy as np
from autograd.extend import primitive, defvjp, defjvp
from autograd.numpy.numpy_vjps import unbroadcast_f, repeat_to_match_shape
from __future__ import absolute_import

### Beta function ###
beta    = primitive(scipy.special.beta)
betainc = primitive(scipy.special.betainc)
betaln  = primitive(scipy.special.betaln)


# Path: autograd/extend.py

# 
# Path: autograd/numpy/numpy_vjps.py
# def unbroadcast_f(target, f):
#     target_meta = anp.metadata(target)
#     return lambda g: unbroadcast(f(g), target_meta)
# 
# def repeat_to_match_shape(g, shape, dtype, axis, keepdims):
#     """Returns the array g repeated along axis to fit vector space vs.
#        Also returns the number of repetitions of the array."""
#     if shape == ():
#       return g, 1
#     axis = list(axis) if isinstance(axis, tuple) else axis
#     new_shape = onp.array(shape)
#     new_shape[axis] = 1
#     num_reps = onp.prod(onp.array(shape)[axis])
#     # Can't use broadcast_to because of numpy bug: https://github.com/numpy/numpy/issues/9165
#     # return anp.broadcast_to(anp.reshape(g, new_shape), shape), num_reps
#     return anp.reshape(g, new_shape) + onp.zeros(shape, dtype=dtype), num_reps


# Path: autograd/scipy/special.py
import scipy.special
import autograd.numpy as np
from autograd.extend import primitive, defvjp, defjvp
from autograd.numpy.numpy_vjps import unbroadcast_f, repeat_to_match_shape

from __future__ import absolute_import

### Beta function ###
beta    = primitive(scipy.special.beta)
betainc = primitive(scipy.special.betainc)
betaln  = primitive(scipy.special.betaln)


defvjp(beta,