Pytorch implementation of Mask R-CNN is multilevel inheritance:
class GeneralizedRCNN(nn.Module):
     def __init__(self, sm inputs):
           self.sm_inputs=sm_inputs
     def forward(self, x):
           sm_outputs=self.sm_inputs(x)
           return sm_outputs

class FasterRCNN(GeneralizedRCNN):
     def __init__(self, sm_cool_inputs):
           super(FasterRCNN, self).__init__(sm_inputs=sm_cool_inputs)

class MaskRCNN(FasterRCNN):
     def __init__(self, sm_awsm_inputs):
           super(MaskRCNN, self).__init__(sm_cool_inputs=sm_awsm_inputs)
           self.sm_module.sm_more = sm_awsm_inputs.sm_awsm_input

Finally, you write a script where you call
mymodel=MaskRCNN(**awsm_kwargs)
mymodel(sm_awsm_img)

So how does one actually get to run the forward method in the base class? I think it is some ‘magic method’ like __getitem__ for dataset interfaces. Is this correct?