Thank for reply.
But it seems do not work. I think you mean that the code should be modified from
weight = torch.load('./weights')
model.load_state_dict(weight)

to
model.load_state_dict(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…