is there any chance you can give a repro?
It should not crash, it should flush the cache of the caching allocator and then re-alloc.
DataLoader has an option to drop the last batch (if it’s odd sized), with drop_last=True, you can use that option to unblock yourself: http://pytorch.org/docs/master/data.html#torch.utils.data.DataLoader 11