L1Loss is differentiable everywhere except at 0.
I notice you don’t reset the gradients on each epoch. You need to run optimizer.zero_grad() before running loss_this_epoch.backward() otherwise the gradients for each epoch just get added to the gradients from the previous epoch.
That messes with the training.