Difference between nn.Module and Module from nn.Modules.Module

Hello Mahsa!

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

with this code:

Source code for torch.nn.modules.module

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

1 Like