基于pytorch手动code损失函数,并比较了7种梯度下降算法
import torch
import matplotlib.pyplot as plt
import torch.optim as optim
import random
def grad_down(optimizer, x, w, y):
optimizer.zero_grad()
output = torch.mv(x, w)
loss = MSELoss(out...
原创
2019-05-20 11:55:20 ·
444 阅读 ·
0 评论