Hey, I am getting this error and I don’t know what to do could anyone resolve it ?
AttributeError: module ‘torch.nn’ has no attribute ‘module’
This is the code for which I am facing the above error
import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.module):
def init(self):
super().init()
self.con1 = nn.Conv2d(1, 32, 5)  # here 1=input, 32=output i.e. 32 conv-features, 5=kernel size
self.con2 = nn.Conv2d(32, 64, 5)
self.con3 = nn.Conv2d(64, 128, 5)
    x = torch.randn(50,50).view(-1,1,50,50)
    self._to_linear = None
    self.convs(x)
    
    self.fc1 = nn.Linear(self._to_linear, 512)
    self.fc2 = nn.Linear(512, 2)
def convs(self, x):
    x = F.max_pool2d(F.relu(self.conv1(x)),  (2,2))
    x = F.max_pool2d(F.relu(self.conv2(x)),  (2,2))
    x = F.max_pool2d(F.relu(self.conv3(x)),  (2,2))
    
    print(x[0].shape)
    
    if self._to_linear is None:
        self._to_linear = x[0].shape*x[0].shape[1]*x[0].shape[2]
    return x

def forward(self, x):
    x = self.convs(x)
    x = x.view(-1,self._to_linear)
    x = F.relu(self.fc1(x))
    x = self.fc2(x)
    return F.softmax(x, dim=1)

net = Net()