For regression, I used loss as nn.MSELoss(). But, after 3,4 iterations of loss, the weights of final layer got to infinity. Resultantly, loss and output also went to infinity / Nan. When I switched nn.L1Loss(), everything is fine. I tried different number of input samples and also normalized all the input data. Any thoughts?