AshwinRJ / Federated-Learning-PyTorch

Implementation of Communication-Efficient Learning of Deep Networks from Decentralized Data
MIT License
1.27k stars 446 forks source link

copy.deepcopy(model), why? #41

Open Turningl opened 1 year ago

Turningl commented 1 year ago

Hello, your project has helped me a lot. Thank you very much. But I have a question: why do I need copy.deepcopy(model) when I am trying to implement a federated learning model, it seems that without copy.deepcopy all models will have the same weight. It's only when you use it that the model is different. So why is that?

saigontrade88 commented 12 months ago

Hi, Can you provide the filename together with the corresponding line number? y = copy.deepcopy(x) returns y which is a copy of variable x. Any future operations on x will not affect y.