Getting TypeError: 'module' object is not callable in #41 lecture #1266
Replies: 1 comment
-
Found the error. I used parameter (p is in lower case) instead of Parameter(P is in uppercase) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The x: torch.Tensor means that the forward() method is expecting x to be of type torch.Tensor.
And the -> torch.Tensor means that the forward() method returns a torch.Tensor too
torch.manual_seed(42)
#2 create an instance of the model / subclass of nn.Module
model_0 = LinearRegressionModel()
#3 checkout the parameters from the class / model
#list(model_0.parameters()) we can use this formula also. but if we need more clear output with named parameters we can use below one.
list(model_0.parameters())
TypeError Traceback (most recent call last)
/tmp/ipython-input-1580758094.py in <cell line: 0>()
2
3 #2 create an instance of the model / subclass of nn.Module
----> 4 model_0 = LinearRegressionModel()
5
6
/tmp/ipython-input-3563944508.py in init(self)
4
5 #initializing model parameters weight & bias.
----> 6 self.weight=nn.parameter(torch.randn(1, requires_grad=True, dtype=torch.float)) #here 1 means random weight. starts with random weight and try to adjust it to the ideal weight.
7 self.bias =nn.parameter(torch.randn(1, requires_grad=True, dtype=torch.float)) #requires_grad = True means pytorch will track the gradients of this specific parameter for use with torch.autograd & gradient descent. for many torch.nn modules, it is set by default..
8
TypeError: 'module' object is not callable
Beta Was this translation helpful? Give feedback.
All reactions