ATen/cuda/CUDAContext.h: No such file or directory缺少这个文件

发布时间 2023-10-14 11:26:56作者: 仙女无可奈何

报错:(FlowGANCUDA10.0) lww@r750:~/projects/FlowGAN-main/FlowGAN-main/lib/metrics/pytorch_structural_losses$ make
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
CXX src/structural_loss.cpp
g++ src/structural_loss.cpp -MMD -MP -pthread -fPIC -fwrapv -std=c++14 -DNDEBUG -O3 -I./ -I/include -I/usr/include/python3.8 -DTORCH_API_INCLUDE_EXTENSION_H -D_GLIBCXX_USE_CXX11_ABI=0 -Wall -Wno-sign-compare -Wcomment -c -o objs/structural_loss.o
src/structural_loss.cpp:1:10: fatal error: ATen/cuda/CUDAContext.h: No such file or directory
1 | #include <ATen/cuda/CUDAContext.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:84: objs/structural_loss.o] Error 1

说的好像是PyTorch ATen缺少cuda/CUDAContext.h这个文件,我首先去检查了一下是否有这个文件

检查发现是我的makefile文件中的配置没有改成我自己的

 然后就解决了这个问题啦!!

还有什么问题可以交流一下v:xx257972,备注来哦(接科研论文ppt代做)