Hi All,
Im also getting the same error
My code is here:-
class Fashion_MNIST_NeuralNet(nn.Module) :
  
  def __init__(self) :
    
    #Calling the module class for the reason mentioned above...
    super(Fashion_MNIST_NeuralNet,self).__init__()
    self.fMnistConv1 = nn.Conv2d(in_channels = 1 , out_channels = 6 , kernel_size = 5)
    self.fMnistConv2 = nn.Conv2d(in_channels = 6 , out_channels = 12 , kernel_size = 5)
    
    #adding fully connected layers
    
    self.fMnist_fc1 = nn.Linear(12*4*4 , 120)
    self.fMnist_fc2 = nn.Linear(120 , 84)
    self.fMnist_fc3 = nn.Linear(84 , 10)
    
    
    
  def forward(self,x) :
    #appplying max_pool2d layer to reduce the dimensionality of the matrix obtained from convolutions..
    # Max pooling over a (2, 2) window
    print('Forward pass')
    x = F.max_pool2d(F.relu(self.fMnistConv1(x)), (2, 2))
    # If the size is a square you can only specify a single number
    x = F.max_pool2d(F.relu(self.fMnistConv2(x)), 2)
    print("===x===1" , x.shape)
    x = x.view(-1 , self.get_num_features(x))
    print("==View==" , x.size())
    x = F.relu(self.fMnist_fc1(x))
    x = F.relu(self.fMnist_fc2(x))
    x = self.fMnist_fc3(x)
    return x
   
    
    
  def get_num_features(self ,x):
    print('Number of Features found=====' , x.shape)
    size = x.size()[1:]
    print("Size" , size)
    num_features = 1
    for s in size:
      num_features*=s
    
    print("==Mult==" , num_features)
    return num_features
    
fn = Fashion_MNIST_NeuralNet()





import torch.nn as nn
def fit_model(model , train_loader):
#Train Loader is used from the DataLoader done earlier....
  optimizer = torch.optim.Adam(model.parameters())
  '''
  Parameters :-
  conv1.weight	torch.Size([6, 1, 5, 5])
  conv1.bias	torch.Size([6])
  conv2.weight	torch.Size([12, 6, 5, 5])
  conv2.bias	torch.Size([12])
  fc1.weight	torch.Size([120, 192])
  fc1.bias	torch.Size([120])
  fc2.weight	torch.Size([84, 120])
  fc2.bias	torch.Size([84])
  fc3.weight	torch.Size([10, 84])
  fc3.bias	torch.Size([10])
  '''
  error = nn.CrossEntropyLoss()
  EPOCHS = 5
  model.train()

  for epoch in range(EPOCHS):

    print(epoch)

    for idx , (image , label) in enumerate(train_loader):

      var_X_batch = torch.randn(image.shape)
      print(var_X_batch.shape)
      var_y_batch = torch.tensor(label)

      optimizer.zero_grad()
      #passing the batch of images to the FNet_MNIST
      print('Debug 1')
      output = model(var_X_batch)
      print('Debug 2')
      loss = error(output, var_y_batch)
      print('Debug 2')
      loss.backward()
      #backpropagation....
      #Step gradient function....
      optimizer.step()

      predicted = torch.max(output.data, 1)[1] 
      correct += (predicted == var_y_batch).sum()
      #print(correct)
      if idx % 50 == 0:
        print('Epoch : {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}\t Accuracy:{:.3f}%'.
        format(
          epoch, idx*len(X_batch), len(train_loader.dataset), 100.*idx / len(train_loader), loss.data[0], float(correct*100) / float(BATCH_SIZE*(idx+1))))

Please let me know what am i missing
Thanks in advance!!