Error - Linear Regression - tensor(nan, grad_fn=<MseLossBackward0>)

When I run my code I get the output of loss as ‘nan’. How do I fix this issue?
Here is the link to my notebook.

image

Thank you

MSELoss is prone too numerical instability.
You can either lower the learning rate, or change loss function.

There’s also a possibility that your model introduces such value somewhere. You would need to check if the output is correct. I see there’s also some warning in your code - this might be the source of a problem as well.