title: Loading a torchscript model in C++: Cannot initialize CUDA without ATen_cuda library
body: <p>I have built a CNN with Pytorch with GPU support. It works fine in python and I would like to import it in my C++ application using VS2017. I am following these instructions <a href="https://pytorch.org/tutorials/advanced/cpp_export.html" rel="nofollow noreferrer">here</a> and <a href="https://medium.com/@boonboontongbuasirilai/building-pytorch-c-integration-libtorch-with-ms-visual-studio-2017-44281f9921ea" rel="nofollow noreferrer">here</a>.<br>I can build and run the application, but I get this error when loading the model:</p>
  
  <pre><code>error loading the model
  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. (initCUDA at 
  C:\w\1\s\windows\pytorch\aten\src\ATen/detail/CUDAHooksInterface.h:63)
  (no backtrace available)
  </code></pre>
  
  <p>I cannot find any <code>ATen_cuda file</code> in the <code>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1</code>.<br>Has anyone a Windows C++ VS2017 Pytorch with GPU working sample? </p>