AshwinRJ / Federated-Learning-PyTorch

Implementation of Communication-Efficient Learning of Deep Networks from Decentralized Data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy.deepcopy(model), why?

Turningl opened this issue · comments

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?

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.