-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Open
Labels
module: nnRelated to torch.nnRelated to torch.nntriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Bug
torch.nn.Module.__init__ doesn't call the super().__init__() , which will case troubles in multiple inheritance.
To Reproduce
For example,
import torch
class MyBase(object):
def __init__(self):
super().__init__()
print('Base initialized!')
class A(torch.nn.Module, MyBase):
def __init__(self):
super().__init__()
print('A initialized!')
class B(torch.nn.Module, MyBase):
def __init__(self):
super().__init__()
print('B initialized!')
class C(A, B):
def __init__(self):
super().__init__()
print('C initialized!')
c = C()will only print
B initialized!
A initialized!
C initialized!
while MyBase.__init__ is NOT called.
Expected behavior
Base initialized!
B initialized!
A initialized!
C initialized!
Environment
PyTorch 1.3.0
Additional context
tchittesh
Metadata
Metadata
Assignees
Labels
module: nnRelated to torch.nnRelated to torch.nntriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module