From cd38172f35e8df87b1ba7760cb599c22fa01180d Mon Sep 17 00:00:00 2001 From: Francois Chollet Date: Tue, 8 Feb 2022 17:45:19 -0800 Subject: [PATCH] Remove usage of deprecated layer method. PiperOrigin-RevId: 427339701 --- .../privacy/optimizers/dp_optimizer_vectorized_test.py | 3 ++- .../tf_estimator_evaluation_test.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py index ed209dd..1e6ab9e 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_vectorized_test.py @@ -132,7 +132,8 @@ class DPOptimizerTest(tf.test.TestCase, parameterized.TestCase): def linear_model_fn(features, labels, mode): preds = tf.keras.layers.Dense( - 1, activation='linear', name='dense').apply(features['x']) + 1, activation='linear', name='dense')( + features['x']) vector_loss = tf.math.squared_difference(labels, preds) scalar_loss = tf.reduce_mean(input_tensor=vector_loss) diff --git a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py index 8d68d22..515ba12 100644 --- a/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py +++ b/tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py @@ -41,7 +41,7 @@ class UtilsTest(absltest.TestCase): del labels input_layer = tf.reshape(features['x'], [-1, self.ndim]) - logits = tf.keras.layers.Dense(self.nclass).apply(input_layer) + logits = tf.keras.layers.Dense(self.nclass)(input_layer) # Define the PREDICT mode becasue we only need that if mode == tf.estimator.ModeKeys.PREDICT: