From 00384db109c98ee757f51414c52699ab40480840 Mon Sep 17 00:00:00 2001 From: William Kong Date: Tue, 11 Jun 2024 09:38:13 -0700 Subject: [PATCH] Expose `noise_multiplier` and `l2_norm_clip` as public read-only attributes. PiperOrigin-RevId: 642298339 --- tensorflow_privacy/privacy/keras_models/dp_keras_model.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tensorflow_privacy/privacy/keras_models/dp_keras_model.py b/tensorflow_privacy/privacy/keras_models/dp_keras_model.py index 9427713..4879b3b 100644 --- a/tensorflow_privacy/privacy/keras_models/dp_keras_model.py +++ b/tensorflow_privacy/privacy/keras_models/dp_keras_model.py @@ -157,6 +157,14 @@ def make_dp_model_class(cls): self.train_step, experimental_compile=True ) + @property + def noise_multiplier(self): + return self._noise_multiplier + + @property + def l2_norm_clip(self): + return self._l2_norm_clip + def _process_per_example_grads(self, grads): grads_flat = tf.nest.flatten(grads) squared_l2_norms = [