I’m reading mobilenetv2 implementation vision/mobilenetv2.py at master · pytorch/vision · GitHub
I noticed that when doing init(), some module are using super(XXX, self).init().
For example, class InvertedResidual() are using
super(InvertedResidual, self).init()
This class inherited from nn.Module, my understanding is: it just needs to use super().init() to get its parent class(nn.Module) to do initialization, but why passing itself to super()?
You’re right, super().__init__()
suffices in that usage in Python3. Passing itself to super
is basically Python2 style: 2. Built-in Functions — Python 2.7.18 documentation.
Note that this is not technically correct in some details.
Thank you for the explanation