UPDATE
I realize that my data was passed into the model as numpy arrays (not ‘shared’ variables). I accidentally re-initialized the model with differently shaped arrays, which caused this problem. The obvious solution is to make sure to re-initialize with the same shapes (data etc).