My input is variable-sized, such as torch.Size([4, 2, 100]), torch.Size([4, 2, 100]), torch.Size([5, 2, 100]), torch.Size([6, 2, 100]), torch.Size([6, 2, 100])
I want the same size in each batch, for example torch.Size([4, 2, 100]), torch.Size([4, 2, 100]) are in the same batch.
My original method is as follow:

Sorting the input by the first dimension size.
Dividing into a list of tuple with batch size, like [ (Size([4, 2, 100]),Size([4, 2, 100])), (Size([5, 2, 100]), Size([5, 2, 100]))]. Batch size is 2.
Shffuling the index of the list.

Although my method can work, I want to speed up the program by using Dataloader.
Does the input with the smaller original size (such as Size([1, 2, 100])) have any effect during training when I pad all the inputs into the same size (such as Size([10, 2, 100]))?
Thank you.