Hierarchical model with closed-form parameter derivative


I know, I can aid the automatic differentiation of theano operations by supplying the grad operation. In the context of a pymc3 model, this works nicely if I sample from a closed-form likelihood function and grad is the derivative with respect to the samples/observations. Say myLikelihood is a theano operation with a custom grad then I can define

 with pm.Model() as model:
    mydist = pm.DensityDist('likelihood', myLikelihood,
                            testval=x0, shape=x0.shape)

However, when I define a hierarchical model with an implicit likelihood function defined through given observations ob_data, e.g., like so:

 with pm.Model() as model:
    par = pm.Normal('parameter', mu = 0, sd = 1, shape = 1)
    obs = pm.DensityDist('observations', parLikelihood,
                         par = par, observed = ob_data)

Such a likelihood needs to take in the parameters par and its derivative needs to be defined with respect to these parameters instead of the observations.

Can I define such a parametrized parLikelihood with a closed form derivative with respect to par in pymc3 and how so?