nn.Module basic

Code for the beginner

import torch.nn as nn
import torch.nn.functional as F

class Net(nn.Module):
    def __int__(self):
        super(Net,self).__int__()
        self.fc1 = nn.Linear(28*28,200)
        self.fc2 = nn.Linear(200,200)
        self.fc3 = nn.Linear(200,10)

    def forward(self,x):
        x=F.relu(self.fc1(x))
        x=F.relu(self.fc2(x))
        x=self.fc3(x)
        return F.log_softmax(x)

net=Net()
print(net)

expected output

Net (
(fc1): Linear (784 -> 200)
(fc2): Linear (200 -> 200)
(fc3): Linear (200 -> 10)
)

My output

Net()

What is going wrong?

It’s just a typo (use init):

must be

def __init__(self):
    super(Net,self).__init__()