It looks like you are running out of ram memory during the dot product trying to calculate theta.
Given that theta is deterministic and can be calculated from the other parameters of the trace, I would not wrap in in a deterministic statement. The code will work the same, the only difference is that theta won’t be stored in the trace. If the reason for the memory error is that the whole trace is too big, this will reduce the memory requirements and probably fix the issue (there is always the possibility of this not reducing memory consumption enough which will require extra changes in addition to this). If you really need the values of theta, you can always calculate them afterwards using libraries like dask that support out of memory computation.
If the suggestion above is still not enough, I’d recommend running the chains 1 by 1 and then combining them. If you use return_inferencedata=True you can use az.concat to combine multiple traces into a single object that can then be passed to az.summary, az.plot_trace… Note that you should use idata_kwargs={"log_likelihood": False} to keep memory consumption to a minimum if you don’t need to perform model comparison.