Eric-mingjie / network-slimming

Network Slimming (Pytorch) (ICCV 2017)
MIT License
909 stars 214 forks source link

vgg_prune.py #16

Closed 20victor12 closed 5 years ago

20victor12 commented 5 years ago

hey Eric. i got this error during pruning , can you suggest me how should i handle it. Thanks

Traceback (most recent call last): File "vggprune.py", line 73, in mask = weight_copy.abs().gt(thre).float() RuntimeError: Expected object of backend CUDA but got backend CPU for argument #2 'other'

cardwing commented 4 years ago

In my case, replacing mask = weight_copy.abs().gt(thre).float().cuda() with mask = weight_copy.abs().gt(thre.cuda()).float().cuda() works.

ningscapr commented 4 years ago

Thanks @cardwing, it works!