I don’t see coef_mode[i] = acc[i-1] + coef_prior[i-1] * task_array[i-1] anywhere in the code I’ve provided. What I provided was return acc + coef_prior * task_array. My understanding, which may be flawed, was that if I supplied a zero initialized tensor (initial_acc), then I could add up the effects from each coefficient (\beta_i) and task array (X_i) one step at a time using pytensor.scan and the defined step function. I’m assuming that when I return acc + coef_prior * task_array, that value gets passed into the next step call as the acc variable. If that’s the case, then the pytensor.scan should be accumulating the independent effects from each \beta_iX_i combination one step at a time. Is there a flaw in this logic?