Generally it shouldn’t be a problem, if your last batch is smaller, as the target should have the same shape.
However, while your data has a batch size of 20, the counterpart has 22 samples.
Do you have any idea how this might happen in your code?
A fast workaround would be to drop the last batch by setting drop_last=True in your DataLoader.