Merry
Merry

Reputation: 255

Confused with the use of super() in Pytorch for neural net construction

I understand the use of super() to inherit attributes and methods from a class when initializing your class. However, when using this in the context of neural networks such as:

class Net(nn.Module):
      def __init__(self, num_inputs, num_outputs, num_hiddens1, num_hiddens2,
                 is_training = True):
          super(Net, self).__init__()

I am confused on why super() is calling the same class. What does this mean and why is this done?

Thanks very much!

Upvotes: 7

Views: 1201

Answers (0)

Related Questions