The last batch might be smaller, if the number of samples in your Dataset is not divisible without a remainder by your batch size.
If you don’t want this behavior, you could specify drop_last=True in your DataLoader, or alternatively use the (maybe) smaller batch size for the last batch with x = x.view(x.size(0), your_size).