折叠
摘要: import torch x = torch.arange(4.0) x tensor([0., 1., 2., 3.]) 在计算梯度之前,需要存放梯度 x.requires_grad_(True) x.grad #默认为None y = 2*torch.dot(x,x) y tensor(28., 阅读全文
posted @ 2021-06-23 19:39 Coverpast 阅读(169) 评论(0) 推荐(0) 编辑