Use as_op is likely very inefficient, there is an effort to introduce cdf to the distribution class but progress is a bit slow: https://github.com/pymc-devs/pymc3/pull/2688
Having said that, it is possible to make it work with as_op as well, you can try:
@as_op(itypes=[tt.dmatrix, tt.dvector, tt.dvector], otypes=[tt.dmatrix])
def fn(P, alphas, betas):
return beta.ppf(norm.cdf(P), alphas, betas)
import theano
with pm.Model() as model:
packed_L = pm.LKJCholeskyCov('packed_L',
n=S, eta=1,
sd_dist=pm.HalfCauchy.dist(2.5))
chol = pm.expand_packed_triangular(S, packed_L)
M = pm.MvNormal('M', mu=hyper_mu, chol=chol, shape=(S, S))
Q = fn(M, theano.shared(alphas.astype('float64')), theano.shared(betas.astype('float64')))