Validation part slow down as epoch progress

As epoch progress validation part slow down extremely. I run the code for 20 epoch. For validation i follow the usual method of “model.eval()” and " with torch.no_grad()". I just calculating PSNR and SSIM in validation without calling backward().

After validation when i switch to “model.train()” part, execution speed is quite good and constant for all the epochs.

Are you using larger inputs during validation or have you changed anything else in the validation pass which would take more compute resources?

Switch to custom PSNR function solved the issue. Thanks.