From 0f01617797a3d22aa8e02175650be029b730228f Mon Sep 17 00:00:00 2001 From: Manju <49522757+manju-dev@users.noreply.github.com> Date: Sun, 3 Jan 2021 15:54:14 +0530 Subject: [PATCH] small fix: torch.nn.Parameter instead of nn.Linear * nn.Linear module is not defined in Polynomial3 model. * torch.nn.Parameter is used to defined the members of the model --- beginner_source/examples_nn/polynomial_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beginner_source/examples_nn/polynomial_module.py b/beginner_source/examples_nn/polynomial_module.py index 7b20a5523be..0fa401bad04 100755 --- a/beginner_source/examples_nn/polynomial_module.py +++ b/beginner_source/examples_nn/polynomial_module.py @@ -49,8 +49,8 @@ def string(self): model = Polynomial3() # Construct our loss function and an Optimizer. The call to model.parameters() -# in the SGD constructor will contain the learnable parameters of the nn.Linear -# module which is members of the model. +# in the SGD constructor will contain the learnable parameters (defined +# with torch.nn.Parameter) which are members of the model. criterion = torch.nn.MSELoss(reduction='sum') optimizer = torch.optim.SGD(model.parameters(), lr=1e-6) for t in range(2000):