Hi Thanks for replying
Well when i modify my model1 weights with the code below

model1.x_layer.weight.data = model2.x_layer.weight.detach().clone()

my model keeps updating without any problem. i mean i don’t understand exactly if i should update my optimizer or it is not needed.
This is a federated learning scenario in which i update my models a few epochs and then i want to aggregate them and feed the aggregated model back to them.