Skip to content

Commit

Permalink
343 fixes svt_privacy (#348) (#349)
Browse files Browse the repository at this point in the history
Fixes #343

Co-authored-by: Wenqi Li <[email protected]>
  • Loading branch information
YuanTingHsieh and wyli authored Mar 25, 2022
1 parent 9310969 commit bb45e7d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nvflare/app_common/filters/svt_privacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def process(self, shareable: Shareable, fl_ctx: FLContext) -> Shareable:
noise = np.random.laplace(scale=self.gamma * 2.0 / self.eps_3, size=accepted.shape)
self.log_info(fl_ctx, "noise max: {}, median {}".format(np.max(np.abs(noise)), np.median(np.abs(noise))))
delta_w[accepted] = np.clip(delta_w[accepted] + noise, a_min=-self.gamma, a_max=self.gamma)
candidate_idx = list(set(np.arange(delta_w.size)) - set(accepted))
delta_w[candidate_idx] = 0.0

# resume original format
Expand Down

0 comments on commit bb45e7d

Please sign in to comment.