From 701a585e1ad2c4f7fb99f7e92cd6c6aa9050996d Mon Sep 17 00:00:00 2001 From: Galen Andrew Date: Thu, 9 Mar 2023 13:55:47 -0800 Subject: [PATCH] Revert to dp-accounting 0.3.0 API. PiperOrigin-RevId: 515432485 --- .../analysis/compute_dp_sgd_privacy_lib.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tensorflow_privacy/privacy/analysis/compute_dp_sgd_privacy_lib.py b/tensorflow_privacy/privacy/analysis/compute_dp_sgd_privacy_lib.py index 7a070c4..678824a 100644 --- a/tensorflow_privacy/privacy/analysis/compute_dp_sgd_privacy_lib.py +++ b/tensorflow_privacy/privacy/analysis/compute_dp_sgd_privacy_lib.py @@ -213,11 +213,15 @@ def _compute_dp_sgd_example_privacy( else: count = int(math.ceil(num_epochs)) event_ = dp_accounting.SelfComposedDpEvent(count=count, event=event_) - return ( - dp_accounting.rdp.RdpAccountant() # TODO(b/271341062) - .compose(event_) - .get_epsilon(example_delta) + + rdp_orders = ( + [1 + x / 10.0 for x in range(1, 100)] + + list(range(11, 64)) + + [128, 256, 512, 1024] ) + accountant = dp_accounting.rdp.RdpAccountant(rdp_orders) # TODO(b/271341062) + accountant.compose(event_) + return accountant.get_epsilon(example_delta) def compute_dp_sgd_privacy(n, batch_size, noise_multiplier, epochs, delta): @@ -269,4 +273,5 @@ def compute_dp_sgd_privacy(n, batch_size, noise_multiplier, epochs, delta): steps, ) - return accountant.compose(event).get_epsilon_and_optimal_order(delta) + accountant.compose(event) + return accountant.get_epsilon_and_optimal_order(delta)