Skip to content

Commit

Permalink
Fix processing client weights
Browse files Browse the repository at this point in the history
  • Loading branch information
EricDinging committed Dec 17, 2023
1 parent 7918a28 commit 26a1f8c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fedscale/cloud/aggregation/optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ def update_round_gradient(
update_weights = result["update_weight"]
if type(update_weights) is dict:
update_weights = [x for x in update_weights.values()]

weights = [
torch.from_numpy(np.asarray(x, dtype=np.float32)).to(
device=self.device
)
for x in update_weights
torch.tensor(x).to(device=self.device) for x in update_weights
]
grads = [
(u - v) * 1.0 / learning_rate for u, v in zip(last_model, weights)
Expand Down

0 comments on commit 26a1f8c

Please sign in to comment.