The problem is solved. Thanks to this post and discussion between @ljj7975 & @ptrblck for hinting me towards checking if the computation graph was broken somewhere. It was exactly that. The computation graph was broken while calling loss.backward().
2 Likes