I’m writing a regression program in pytorch and when it runs, the model gives the following error:
Expected object of scalar type Float but got scalar type Double for argument #4
The error occurs at this location:
class LinearRegression(torch.nn.Module):
def init(self):
super(LinearRegression, self).init()
self.linear = torch.nn.Linear(1, 1)
def forward(self, x):
y_pred = self.linear(x) <---- ERROR OCCURS HERE
return y_pred
The full program and data can be downloaded here: https://drive.google.com/open?id=1Ct9hsYoLNeBhua6-Ch4e5xS4Mds1oyWR
Any help would be greatly appreciated.