首页 百问百答 帖子详情
torch gpu的代码在torch cpu中运行时报错,怎样解决?
收藏
快速回复
百问百答 问答学习资料 607 2
torch gpu的代码在torch cpu中运行时报错,怎样解决?
收藏
快速回复
百问百答 问答学习资料 607 2

RuntimeError: Cannot initialize CUDA without ATen_cuda library. PyTorch splits its backend into two shared libraries: a CPU library and a CUDA library; this error has occurred because you are trying to use some CUDA functionality, but the CUDA library has not been loaded by the dynamic linker for some reason. The CUDA library MUST be loaded, EVEN IF you don't directly use any symbols from the CUDA library! One common culprit is a lack of -Wl,--no-as-needed in your link arguments; many dynamic linkers will delete dynamic library dependencies if you don't depend on any of their symbols. You can check if this has occurred by using ldd on your binary to see if there is a dependency on *_cuda.so library.

0
收藏
回复
全部评论(2)
时间顺序
Lerbron
#2 回复于2023-01

你这有数据在GPU上吧

0
回复
壹‖零
#3 回复于2023-01

将代码中的cuda改为cpu应该就能解决

0
回复
在@后输入用户全名并按空格结束,可艾特全站任一用户