the codes are self explanatory. More background information here :
https://www.youtube.com/watch?app=desktop&v=c36lUUr864M&t=1486s
https://towardsdatascience.com/linear-regression-with-pytorch-eb6dedead817
https://pytorch.org/tutorials/beginner/pytorch_with_examples.html