Thanks for your reply again. My batch size is 64.  This is the part of code which is causing this eeror.
      ValueError                                Traceback (most recent call last)
    <ipython-input-178-d3334fef0b32> in <module>
  18         output = model(inputs)
  19 
   ---> 20         loss = criterion(output, targets.long())
  21         train_losses.append(loss.item())
  22         loss.backward()