Learn practical skills, build real-world projects, and advance your career
import numpy as np
import torch
#Input 
inputs = np.array([[73, 67, 43], [91, 88, 64], [87, 134, 58], [102, 43, 37],[69, 96, 70]], dtype='float32')
#Target
targets = np.array([[56, 70], [81, 101], [119, 133], [22, 37], [103, 119]], dtype='float32')

#Convert to Torch
inputs = torch.from_numpy(inputs)
targets = torch.from_numpy(targets)
#Weights and biases
w=torch.randn(2,3,requires_grad=True)
b=torch.randn(2,requires_grad=True)
def prediction(x,w,b):
    return x @ w.t() + b
def mse_loss(l1,l2):
    diff=l1-l2
    return torch.sum(diff*diff)/diff.numel()