Hi Everyone ,I am a complete beginner in Pytorch,I was trying to implement a very simple Linear Regression Model,but I am getting this “optimizer got an empty list error”.Kindly note that the x_train is a one -dimensional vector.Please mention the appropriate changes .Thanks!!!in Advance
This my piece of code
class LinearRegressionModel(nn.Module):
def init(self):
super(LinearRegressionModel,self).init()
self.linear=nn.Linear(1,1)
def forward(self,x):
out=self.linear(x)
return out
model=LinearRegressionModel()
criterion=nn.MSELoss()
learning_rate=0.01
optimizer=torch.optim.SGD(model.parameters(),lr=learning_rate)