i read the article on super().init() but didn’t quite understand it why it was being used except to initialize nn modules . so, can explain why are we using super.init inside the init function ??

The “super” function is used in Python to access the methods (functions) and properties of the parent class to the child class. It returns the proxy or temporary object of the parent class which enables access to all the methods of the parent class. This is a concept of Python classes and inheritance. Let me explain this with a simple example:

class Classone:
    def __init__(self): = 'Hello'
class Classtwo(Classone):
    def __init__(self):

    def show(self):
        print("{} in Another class".format(

c = Classtwo()

The output of this will be:

Hello in Another class

In this way, the nn modules class is used as the base class to create our custom classes. I hope you understood my point. Feel free to ping again.


Thank You , got it now.

1 Like