Could you check, if all input tensors have the same shape?
I’m unsure how to further debug the issue, if your code snippet works fine.
Assuming you are not changing the model I think the input data shape changes (accidentally).