I am trying to call pytorch code with C++, and the C++ code is called in Qt.
All the things goes right but when the code run:
weight = torch.load('./weights.pth')
Concretely, If i run the C++ and pytorch code without Qt, the program runs correctly. But if the code is implemented in Qt, the weights can not be loaded. By the way, random initialization is ok.
I am confused.
Could someone help me?
Thank for reply.
But it seems do not work. I think you mean that the code should be modified from
weight = torch.load('./weights')
However, the core question is, PyTorch code is runable in pure Python environment, and then I write C++ interface to call the PyTorch codes. It is noraml and runable, there is no problem. However, in the next step, when I use Qt to call the C++ interface, the code (just ‘load’ command) does not work.
I don’t know is there some conflicts between Qt and PyTorch…