def vector_jacobian_product(fun, argnum=0):
    def vector_dot_fun(*args, **kwargs):
        args, vector = args[:-1], args[-1]
        return np.tensordot(vector, fun(*args, **kwargs), axes=np.ndim(vector))
    return jacobian(vector_dot_fun, argnum)  # Grad wrt original input.
Builds a function that returns the exact vector-Jacobian product, that
dataset/ETHPy150Open HIPS/autograd/autograd/convenience_wrappers.py/vector_jacobian_product