Pytorch, Torch, Torchvision, Deep Learning, Python.
(pred - self.y) ** 2 return sq.mean() def grad(self, pred): pred = self.fit() loss_1 = self.loss(pred) * self.x loss_2 = self.loss(pred) * 1.0 return torch.stack([loss_1.mean(), loss_2.mean()]) for epoch in range(epochs): w, b = params out = model(x, y, b, w) pred = out.fit() loss = out.loss(pred)