0

This is my current code. I understand the in_size and out_size are the sizes of the input and output layers respectively. However, what does the self parameter indicate and what is super().__init__() used for?

class MnistModel(nn.Module):
    """Feedfoward neural network with 1 hidden layer"""
    def __init__(self, in_size, out_size):
        super().__init__()
        # hidden layer
        self.linear1 = nn.Linear(in_size, 16)
        # hidden layer 2
        self.linear2 = nn.Linear(16, 32)
        # output layer
        self.linear3 = nn.Linear(32, out_size)
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Pmesh
  • 11
  • 3
  • what language background are you coming from? [This tutorial](https://docs.python.org/3/tutorial/classes.html) could be your first stopping point – Marat Oct 12 '21 at 20:16
  • Does this answer your question? [understanding python super with init methods](https://stackoverflow.com/questions/576169/understanding-python-super-with-init-methods) – Michael Szczesny Oct 12 '21 at 20:55
  • 1
    These are basic questions about a language that you should learn by reading a book or taking a course about python. – Dr. Snoopy Oct 12 '21 at 20:56

0 Answers0