复现Graph R-CNN for Scene Graph Generation这篇论文的代码时报错。

在执行训练命令时,报错ImportError: /.../_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2at19UndefinedTensorImpl10_singletonE

原因:cuda、torch、torchvision版本不对应。

 查看torch的cuda版本

python
>>> import torch
>>> torch.version.cuda
'10.0.130'

查看机器的cuda版本

nvcc -V
...
Cuda compilation tools, release 9.0, V9.0.176

发现并不对应,去官网找到符合自己要求的版本https://pytorch/get-started/previous-versions/

论文要求是torch=1.0、cuda=8.0+

conda install pytorch==1.0.0 torchvision==0.2.1 cuda90 -c pytorch

解决问题!虽然报了新的错误,但是至少这个错误解决了,历时两天:)

参考博客:https://blog.csdn/qq1483661204/article/details/103834224

 

更多推荐

undefined symbol: _ZN2at19UndefinedTensorImpl10_singletonE