it gives me another error :
ValueError                                Traceback (most recent call last)
<ipython-input-39-87fb847a7382> in <module>()
      2 val_losses = []
      3 for epoch in range(num_epochs):
----> 4     train(epoch)

4 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)
   1834     if input.size(0) != target.size(0):
   1835         raise ValueError('Expected input batch_size ({}) to match target batch_size ({}).'
-> 1836                          .format(input.size(0), target.size(0)))
   1837     if dim == 2:
   1838         ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)

ValueError: Expected input batch_size (45) to match target batch_size (90).