pytorch / opacus

Training PyTorch models with differential privacy
https://opacus.ai
Apache License 2.0
1.68k stars 337 forks source link

Fixed Opacus's Runtime error with an empty batch (issue 612) #631

Closed EnayatUllah closed 7 months ago

EnayatUllah commented 7 months ago

Summary: In case of an empty batch, in the clip_and_accumulate function, the per_sample_clip_factor variable is set to a tensor of size 0. However, the device was not specified, which throws a runtime error. Added it.

Differential Revision: D53733081

facebook-github-bot commented 7 months ago

This pull request was exported from Phabricator. Differential Revision: D53733081

facebook-github-bot commented 7 months ago

This pull request was exported from Phabricator. Differential Revision: D53733081

facebook-github-bot commented 7 months ago

This pull request was exported from Phabricator. Differential Revision: D53733081

facebook-github-bot commented 7 months ago

This pull request was exported from Phabricator. Differential Revision: D53733081

facebook-github-bot commented 7 months ago

This pull request was exported from Phabricator. Differential Revision: D53733081

facebook-github-bot commented 7 months ago

This pull request has been merged in pytorch/opacus@ac639af72dd374fc938b53ba4877204a38c13171.