Errors are reported when running the pytorch program. It should be a problem with the torch syntax.
Original code:
model=CNN()#CNN as a self-compiling neural network model
best_model_wts = copy.deepcopy(model.state_dict())
*************************************#(the error codes is below)
model=model.load_state_dict(best_model_wts)
Error message:
Modified code:
model=CNN()#CNN as a self-compiling neural network model
best_model_wts = copy.deepcopy(model.state_dict())
model.load_state_dict(best_model_wts)