the left hand side of the equation refers to the weights of one layer, but in the right-hand side refers to all model parameters. I think you would want to put the best model and the current model in a for-loop with zip() function. Assuming that you have two models current_model and best_model, then, the following should work:
for param_cur, param_best in zip(current_model.parameters(), best_model.parameters()):
param_cur.data = param_best.data
Hey, so there is a slight problem… I have an array of Symmetricmodel() objects. Whenever i run your code and then try to modify the object’s parameters() , every one of the parameters() in my object array is changed. Do you know of a way to fix this?
I think I may have solved my problem by adding require_grad=False. Assigning values to certain tensors caused others to be altered. It was really weird. At this point, some models with the exact same weight perform much differently, but that might just be my computer