Generally, this error happens when the dataset size is not divisible by the batchsize leading to an incomplete last batch. But this is handled well by PyTorch’s Dataloader. It could be that there is some other problem.
The error trace picks the error in foward(self, images, targets) of generalized_rcnn.py. And it has something to do with the transforms. Can you post the code in that function here?