I’ve testing some things and apparently the code runs without bugs. Turns out that the problem can be related to model.eval(), because when I remove this line from my training functions, the loss and the accuracy both in train and validation decreases and increases, respectively. The model starts to overfit after the 20th epoch.
Even though I searched some similar problems, but i couldn’t find anything helpful. I found this error really weird. I don’t know if I’m getting the correct values of loss and accuracy without the model.eval() line, though
Thanks for your reply, again.