liuweide01 / RPNet-Weakly-Supervised-Segmentation

Cross-Image Region Mining with Region Prototypical Network for Weakly Supervised Segmentation
MIT License
16 stars 0 forks source link

How to fix this error? #1

Closed Elaineok closed 2 years ago

Elaineok commented 2 years ago

When I run this program, the following error occurs.

File "xxxx/net/resnet50_cam.py", line 106, in cal_cos_vector area = F.avg_pool2d(mask, x.shape[-2:]) h w + 0.0005 RuntimeError: _thnn_avg_pool2d_forward not supported on CUDAType for Byte

liuweide01 commented 2 years ago

When I run this program, the following error occurs.

File "xxxx/net/resnet50_cam.py", line 106, in cal_cos_vector area = F.avg_pool2d(mask, x.shape[-2:]) h w + 0.0005 RuntimeError: _thnn_avg_pool2d_forward not supported on CUDAType for Byte

You can try to change the pytorch version, or convert to float, e.g., data.astype(float)

Elaineok commented 2 years ago

I first tried to convert it to floating point, but it didn't solve it. After that, pytorch 1.4.0 was used to solve this problem perfectly. Thanks for your reply.

LiuWeide @.***> 于2021年10月17日周日 上午10:21写道:

When I run this program, the following error occurs.

File "xxxx/net/resnet50_cam.py", line 106, in cal_cos_vector area = F.avg_pool2d(mask, x.shape[-2:]) h w + 0.0005 RuntimeError: _thnn_avg_pool2d_forward not supported on CUDAType for Byte

You can try to change the pytorch version, or convert to float, e.g., data.astype(float)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/liuweide01/RPNet-Weakly-Supervised-Segmentation/issues/1#issuecomment-945037349, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDG7GDYXXPIPREJSW5OZ3TUHIXLBANCNFSM5GDXG2RA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.