Tensor for argument #2 ‘mat1’ is on CPU, but expected it to be on GPU (while checking arguments for addmm)
Both the model and the input data need to be moved to the device
model=NonLinearRegression().to(device)#Moudle
for batch_idx,(data,target) in enumerate(train_loader):
data,target=data.to(device),target.to(device)
...
for data,target in val_loader:
data,target=data.to(device),target.to(device)
...