In general, a for loop will not perform very well in theano/pymc3. Here your first step should be removing all np* operation with theano.tensor.* operation. I suggest you to first have a look at https://docs.pymc.io/notebooks/PyMC3_tips_and_heuristic.html
1 Like