Split the batching logic from build_detection_train_loader
Split the batching logic from build_detection_train_loader

Summary: to be reused in customized dataloader

Reviewed By: rbgirshick

Differential Revision: D21694836

fbshipit-source-id: caf1a48e6d259e753b09628bb631eaa1bc20c7ab

facebookresearch/detectron2,facebookresearch/detectron2,facebookresearch/detectron2