Currently, I am trying to have a C++ application to make calls to a Python function, which has a Tensor as input. However, I can not cast the C++ Tensor, such that I can use it as input for the Python function. A previous forum post explains that I could use a function named THPVariable_Wrap
for this. However, I tried to import this function, but every time I do so, I get the following error:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) struct _object * __cdecl THPVariable_Wrap(class at::TensorBase)" (__imp_?THPVariable_Wrap@@YAPEAU_object@@VTensorBase@at@@@Z) referenced in function main pythonCppTorchExp C:\Users\MyName\source\repos\pythonCppTorchExp\pythonCppTorchExp\example-app.obj 1
I also looked at the linked code in the previous forum post and compared it to the current main branch. I saw that the old version is entirely different from the current version. Should I still use THPVariable_Wrap
to cast my Tensor, and if so, how do I import this function, because I am quite new to C++.
p.s. I also asked the question on StackOverflow, which shows the code I use (link to it)