model.eval() solved my original problem as well, thanks!
Still, I find it very interesting that predictions were quite good when validation data was shuffled and much worse without shuffling (i.e. first I had a series of batches of one category and then a series of batches of the other category). I guess it’s the matter of these “running estimates”, but it’s quite surprising for me that the influence was so big.