libtorch在windows上部署时出现这个报错,模型无法加载;解决方案:
在C++->属性->链接器->命令行添加:
/INCLUDE:"?warp_size@cuda@at@@YAHXZ"
/INCLUDE:"?ignore_this_library_placeholder@@YAHXZ"
首先得确保你的libtorch和torch版本一致,不然都是白搭
在使用debug下使用CPU能进行模型测试,但使用GPU出现C10::error;
在img.to(device)->img=img.to(device)
解决方案:debug和release需要分开配置,库不能够共用
libtorch使用教程,知乎上总结
libtorch (pytorch c++) 教程(一) - 知乎