Difficulty calculating model gradients, shared variables with static values, and sparse matrices

I think that your error comes from where you define the observations. interp_real and interp_imag are both arrays, from what I could follow, so your random variables should have a shape compatible with the supplied parameter mu. This means that you should add a shape=something to the pm.Normal("obs_...) RV creation. Regrettably, we can’t handle symbolic shapes, so shape=interp_real.shape wont work. You will have to write down the proper shape tuple that depends on the shapes of your shared arrays’ alpha and delta.