1、torch.cuda.empty_cache() 释放GPU显存空间 torch.cuda.empty_cache() 2、torch.cuda.memory_summary() 查看显存信息 print(torch.cuda.memory_summary())