Why do we need to inherit from nn.Module in PyTorch?
I am going through Udacity's Intro To Deep Learning with Pytorch course In the Neural Network part the instructor says that &quot;in the init method, we need to call super, we need to do that because then PyTorch will know to register all the different layers and operation, if you don't do this part it wont be able to track the things that you are adding to your network and it wont work&quot;. Could you kindly elaborate and explain what exactly is the role of super keyword here and what does nn.Module inherits which helps in &quot;keeping track&quot; of changes.
Further the Jupyter notebooks says the following about use of super,
class Network(nn.Module):


Here we're inheriting from nn.Module. Combined with
super().__init__() this creates a class that tracks the architecture
and provides a lot of useful methods and attributes. It is mandatory
to inherit from nn.Module when you're creating a class for your
network. The name of the class itself can be anything.


class Network(nn.Module) means that you defined a Network class that inherits all the methods and properties from nn.Module (Network is child class and nn.Module is parent class) 
By using super().__init__() , Network's __init__ will be same as its parent __init__.
class Network(nn.Module):
    def __init__(self):
        super(Network, self).__init__()

For example when you make a model:
model = Network() 
by calling this model, actually nn.Module will handle this call and track changes.
visit this link if you want to see nn.Module source codes.
