I guess the last batch might be smaller (3 instead of 4), which might be the case if the number of samples divided by the batch size creates a remainder.
You could use drop_last=True in the DataLoader to get rid of this batch or alternatively make sure your target has the same batch size.