zhuangdizhu / FedGen

Code and data accompanying the FedGen paper
233 stars 68 forks source link

Error: RuntimeError: Can't call `numpy()` on Tensor that requires grad. #15

Open ceh-2000 opened 2 years ago

ceh-2000 commented 2 years ago

Full error message: RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

Added the following as line 227 to serverbase.py to resolve: test_losses = [t.detach() for t in test_losses]

Python version: 3.8.6

bostankhan6 commented 7 months ago

Thank you very much for providing the solution to this error!