logo
Loading...

出現RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'other' in call to _th_min錯誤 - Cupoy

1.把Build SSD_VGG.ipynb 的 Use_cuda = True後,程式跑到 los...

出現RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'other' in call to _th_min錯誤

2020/01/07 上午 00:01
電腦視覺深度學習討論版
胡連福
觀看數:11
回答數:1
收藏數:1

1.把Build SSD_VGG.ipynb 的 Use_cuda = True後,程式跑到 loss_l,loss_c = criterion(out,y ) 時,

出現 RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'other' in call to _th_min

2.我確認 torch.cuda.is_available() 是返回 True,請問這是哪裡有問題 ? 還要做哪些 check 動作 ?

===========================================

RuntimeError                              Traceback (most recent call last)
<ipython-input-15-de7e25ab935e> in <module>
    18         out = net(image_)
    19         '''Regression Loss and Classification Loss'''
---> 20         loss_l,loss_c = criterion(out,y )

      

RuntimeError: Expected object of device type cuda but got device type cpu for argument #2 'other' in call to _th_min

回答列表

  • 2020/01/07 上午 00:36
    楊哲寧
    贊同數:0
    不贊同數:0
    留言數:4

    這一段的 use_cuda也要設定成True:


    Use_cuda=True

    criterion = MultiBoxLoss(21, 0.5, True, 0, False, 3, 0.5,False, Use_cuda,)