import torch from torch import nn torch.manual_seed(11) features = torch.tensor( [[0.0, 0.5], [1.0, -0.5], [2.0, 1.0]], dtype=torch.float32, ) targets = torch.tensor([[0.2], [0.7], [1.6]], dtype=torch.float32) model = nn.Linear(2, 1) loss_fn = nn.MSELoss() optimizer = torch.optim.SGD(model.parameters(), lr=0.05)