AE2d test() throws exception on non-GPU environment
wagavulin opened this issue · comments
wagavulin commented
Hello. I tried to run test.sh
of Dimensionality_Reduction/AE2d
on my PC which doesn't have GPU, but failed with the below error message.
terminate called after throwing an instance of 'c10::Error'
what(): No CUDA GPUs are available
It's because test()
in AE2d/test.cpp
calls torch::cuda::synchronize()
regardless of device type. I think it should be called only on GPU environment. For example:
if (!device.is_cpu()) torch::cuda::synchronize();
Hiroki Kobayashi commented
Thank you for reporting the bug and solution.
I changed the source code and confirmed that it works normally.
I reflected it in master
branch, and the modified code was archived as support/v1.10.1
.
https://github.com/koba-jon/pytorch_cpp/tree/support/v1.10.1
Thank you so much!