Thank you for your answer.I am try to reduce batch size and find batch_size=16 works well.
But I am confusing that under the nn.DataParallel,when batch_size = 32 ,each GPU actually works for 8 images.To my knowledge ,I think 8 images per GPU might be ok because the capacity of this model is relatively small comparing other high level frameworks(object detection semantic segmentation exc…).So I want to know whether my code have bugs or not ,or other way to solve it ( maintain the batch_size )