Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cecea51

Browse files
manju-devbrianjoholly1238
authored
small fix: torch.nn.Parameter instead of nn.Linear (#1302)
* nn.Linear module is not defined in Polynomial3 model. * torch.nn.Parameter is used to defined the members of the model Co-authored-by: Brian Johnson <[email protected]> Co-authored-by: holly1238 <[email protected]>
1 parent 6738ff1 commit cecea51

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

beginner_source/examples_nn/polynomial_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def string(self):
4949
model = Polynomial3()
5050

5151
# Construct our loss function and an Optimizer. The call to model.parameters()
52-
# in the SGD constructor will contain the learnable parameters of the nn.Linear
53-
# module which is members of the model.
52+
# in the SGD constructor will contain the learnable parameters (defined
53+
# with torch.nn.Parameter) which are members of the model.
5454
criterion = torch.nn.MSELoss(reduction='sum')
5555
optimizer = torch.optim.SGD(model.parameters(), lr=1e-6)
5656
for t in range(2000):

0 commit comments

Comments
 (0)