Reputation: 5742
I define a sub-class of PyTorch's Module
in PyCharm and create an instance a
:
from torch.nn import Module
class AModule(Module):
def __init__(self):
self.something = 10
def __repr__(self):
return "AModule"
a = AModule()
If I run the debugger and examine a
, I can't see its attributes:
I checked and Module
is written in Python (as opposed to being implemented in C), so why is that?
Upvotes: 2
Views: 268
Reputation: 5742
This is caused by not having properly initialized Module
with a super
call in the first like of __init__
:
super(AModule, self).__init__()
However, PyCharm could have shown more useful information, so I created this issue.
Upvotes: 1