The details of the error (RuntimeError: Error(s) in loading state_dict for Model) are as follows:
Reason: When training my own model, I used torch.nn.DataParallel to achieve simultaneous training of multiple cards. When loading the trained model for testing without using torch.nn.DataParallel, such an error will be reported.
Solution:
Use descendant code for the model in the code under test
model = torch.nn.DataParallel(model)