On the [numpy page](http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.dirichlet.html) they give the example of

```
s = np.random.dirichlet((10, 5, 3), 20)

```

which is all fine and great; but what if you want to generate random samples from a 2D array of alphas?

```
alphas = np.random.randint(10, size=(20, 3))

```

If you try   
`np.random.dirichlet(alphas)`,   
`np.random.dirichlet([x for x in alphas])`, or   
`np.random.dirichlet((x for x in alphas))`,   

it results in a 
`ValueError: object too deep for desired array`. The only thing that seems to work is:

```
y = np.empty(alphas.shape)
for i in xrange(np.alen(alphas)):
    y[i] = np.random.dirichlet(alphas[i])
    print y

```

...which is far from ideal for my code structure. Why is this the case, and can anyone think of a more "numpy-like" way of doing this?

Thanks in advance.