well… yes, but how to do this? In general I have problems in defining custom operators for multivariate (gaussians). I think I missed something in the learning process about Theano. For instance see another question Multivariate Gaussian with Custom Operator Mean. I know how to implement custom operator for univariates and they works, but when I come to multivariates (such as the present example) I do not how to do.
In your code above, you dont need to wrap it in a custom operator, as your operation is reshaping the 3 scaler into a matrix, the easiest way to do is something like:
with pm.Model() as m:
c11 = ...
c12 = ...
c22 = ...
x = tt.zeros((2, 2))
x = tt.inc_subtensor(x[0, 0], c11)
x = tt.inc_subtensor(x[0, 1], c12)
x = tt.inc_subtensor(x[1, 0], c12)
x = tt.inc_subtensor(x[1, 1], c22)
And theano will take care of the gradient for each scaler.