You don’t need to iterate over the inputs, the p parameter will always be x.owner.inputs[3]. Otherwise that should be fine as long as p has a fixed length. I think we do the same internally here: pymc/metropolis.py at main · pymc-devs/pymc · GitHub