Hi Anas!



 ANAS_KHAN:

know I am getting this error
…
ValueError: Expected input batch_size (14) to match target batch_size (11).


Does this help?
>>> torch.__version__
'1.9.0'
>>> torch.nn.CrossEntropyLoss() (torch.randn (14, 3), torch.randint (3, (11,)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<path_to_pytorch_install>\torch\nn\modules\module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "<path_to_pytorch_install>\torch\nn\modules\loss.py", line 1121, in forward
    ignore_index=self.ignore_index, reduction=self.reduction)
  File "<path_to_pytorch_install>\torch\nn\functional.py", line 2824, in cross_entropy
    return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
ValueError: Expected input batch_size (14) to match target batch_size (11).

Best.
K. Frank