说明: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
<weixin_38631773> 上传 | 大小:19kb