Pytorch, Torch, Torchvision, Deep Learning, Python.
import torch x = torch.randn(5, 2, requires_grad=True) y = torch.randn(5, 2) params = torch.tensor([1.0, 0.0]) epochs = 10 lr = 1e-2 class model(): def __init__(self, x, y, b, w): self.x = x self.y = y self.b = b self.w = w def fit(self): return self.w * self.x + self.b def loss(self, pred): sq =