Hello Mahsa!



 mahsa:

Thanks for your reply. I got a little bit confused. I though in the Model class, nn.Module is from nn package (actually torch.nn) an in the Layer class Module is from nn.Modules.Module. How are the same? Module and Modules aren’t different classes in nn?


I’m a little bit confused, too.
Let me revise what I said.
I don’t think there is a torch.nn.Modules.Module.  Compare the
documentation for torch.nn.Module:
https://pytorch.org/docs/stable/nn.html#torch.nn.Module 14
with this code:
Source code for torch.nn.modules.module 6
From this I conclude that the linked code is the code for the
class torch.nn.Module.  I’m guessing that the url that refers
to “_modules/torch/nn/modules/module.html” is somehow
indicating how pytorch organizes its code, but does not mean
that the class’s full name is “torch.nn.Modules.Module”
(or “torch.nn.modules.Module”).
If this doesn’t make sense, could you link to the Layer code you
mentioned in your original post so we can see how it refers to
torch.nn.Modules.Module and try to figure out what is going on?
Best.
K. Frank