1
0

make exp3 works but no check

This commit is contained in:
2025-12-06 13:10:02 +08:00
parent 1061780ea5
commit 45b60b269f
9 changed files with 254 additions and 72 deletions

View File

@@ -66,8 +66,8 @@ def main():
for t in range(2000):
optimizer.zero_grad() #清空上一步的残余更新参数值
prediction: torch.Tensor = net(test_data.x) #喂给net训练数据x输出预测值
loss: torch.Tensor = loss_func(prediction, test_data.y) #计算两者的误差
prediction: torch.tensor = net(test_data.x) #喂给net训练数据x输出预测值
loss: torch.tensor = loss_func(prediction, test_data.y) #计算两者的误差
loss.backward() #误差反向传播,计算参数更新值
optimizer.step() #将参数更新值施加到net的parameters上