Error when forward() on windows with c++ and libtorch


I’m trying to port my refineDet model from ubuntu with python to Windows with c++,and it’s fine when loading modul with torch::jit::load,but std::runtime_error when forward() in Windows with C++.(But this step is fine in Ubuntu with c++, and if using the model in tutorial doc online, both is ok)

It will break in the following code:

Does anyone have a similar problem?

(Pu Jiachen) #2

The problem is that you are using the debug
configuration with the release version of libtorch, which is not allowed for MSVC.


I’m sure it’s release configuration, and if I load and forward with a model which is generated from the tutorial code(, this problem will not occur.


Makes no sense.
It doesn’t matter which linked library has debug symbols or not.

(Slaweks17) #5

From what I heard, MS C++ does not allow linking a release library to a debug exe. Something about ABI incompatibility.

(Pu Jiachen) #6

Could you try again with nightly debug version of libtorch so that we can get a detailed stack trace?


tks, it doesn’t occur with nightly debug version of libtorch :joy: , so I’m going to try with nightly release version