Can you try that:  drop_last=True
DataLoader(dataset, batch_size=1, shuffle=False, sampler=None,
           batch_sampler=None, num_workers=0, collate_fn=None,
           pin_memory=False, drop_last=False, timeout=0,
           worker_init_fn=None)

https://pytorch.org/docs/stable/data.html 6



drop_last  ( bool ,  optional ) – set to  True  to drop the last incomplete batch, if the dataset size is not divisible by the batch size. If  False  and the size of dataset is not divisible by the batch size, then the last batch will be smaller. (default:  False )