pytorch CUDA out of memor

 

pytorch CUDA out of memor

 

解決方法:

用完把cuda變量 del

顯存能增大一倍

    import time
    net = BiSeNet()
    net.cuda()
    net.eval()
    in_ten = torch.randn(8, 3, 640, 640).cuda()

    for i in range(8):
        start=time.time()
        out, out16, out32 = net(in_ten)
        print(time.time()-start,out.shape,out16.shape,out32.shape)
        del out
        del out16
        del out32

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章