Open Pritush09 opened 1 year ago
While defining the model, in the init method, you should pass the argument (self, x) instead of (self).
class LinearRegressionModel2(nn.Module):
def __init__(self, x):
super().init()
self.linear_layer = nn.Linear(in_features=1,out_features=1) # refer above```
Hello , i had similar issue while using nn.L1Loss(), but when i switched to nn.MSELoss() it worked fine. Can you please explain in which case do we have to add x in the init function?
While defining the model, in the init method, you should pass the argument (self, x) instead of (self).
class LinearRegressionModel2(nn.Module): def __init__(self, x): super().init() self.linear_layer = nn.Linear(in_features=1,out_features=1) # refer above```
Discussed in https://github.com/mrdbourke/pytorch-deep-learning/discussions/398