From 31f110698dc29aadeb9a7f28ef9d7f50206229fa Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 20 Dec 2021 16:52:10 -0800 Subject: [PATCH] Fix of the apply_gradients in Keras DP optimizer. PiperOrigin-RevId: 417503887 --- tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py index 1ba11b9..dc01e2d 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py @@ -351,7 +351,7 @@ def make_keras_optimizer_class(cls): }) return config - def apply_gradients(self, grads_and_vars, global_step=None, name=None): + def apply_gradients(self, *args, **kwargs): """DP-SGD version of base class method.""" assert self._was_dp_gradients_called, ( 'Neither _compute_gradients() or get_gradients() on the ' @@ -359,8 +359,7 @@ def make_keras_optimizer_class(cls): 'training is not differentially private. It may be the case that ' 'you need to upgrade to TF 2.4 or higher to use this particular ' 'optimizer.') - return super(DPOptimizerClass, - self).apply_gradients(grads_and_vars, global_step, name) + return super(DPOptimizerClass, self).apply_gradients(*args, **kwargs) return DPOptimizerClass