diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py index 6ecbb31..6d53a76 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras.py @@ -256,7 +256,8 @@ def make_keras_optimizer_class(cls): # Compute the per-microbatch losses using helpful jacobian method. with tf.keras.backend.name_scope(self._name + '/gradients'): - jacobian = tape.jacobian(microbatch_losses, var_list) + jacobian = tape.jacobian( + microbatch_losses, var_list, unconnected_gradients='zero') # Clip gradients to given l2_norm_clip. def clip_gradients(g):