Hi, let’s see a typical case:
class MyLayer(nn.Module):
def __init__(self)
super(...)
self.a = nn.Parameters(...)
self.b = nn.Linear()
I wonder how can nn.Module
:
- add
self.a
intoself.named_parameters()
and -
self.b
toself.named_children and self.named_module
.
Could anyone introduce the magic behind nn.Module
.
Everytime I use nn.Module
, I felt worried since I dnt understand what nn.Module
DID for me.