1. 首页
  2. 数据库
  3. 其它
  4. 利用pytorch进行线性回归

利用pytorch进行线性回归

上传者: 2020-12-31 15:34:27上传 PDF文件 18.73KB 热度 27次
import torch import matplotlib.pyplot as plt torch.manual_seed(10) lr = 0.1 #learning rate #train data x = torch.rand(20,1)*10 #x data shape(20,1) y = 2*x+(5+torch.randn(20,1))#y data shape(20,1) #build model w = torch.randn((1),requires_grad=True) b = torch.zeros((1),requires_grad=True) for iterati
下载地址
用户评论