How to vectorize indexing of variable for pm.math.sum?

Thanks Junpeng!
Not sure I understand though: isn’t that what I’m doing with:

delta_sum = tt.as_tensor_variable([pm.math.sum(delta_j[: E[i] + 1]) for i in range(len(E))])
phi = bE * delta_sum + bA * A

?