From 085b7ddfecc8443910e3a374e6d3c80bdc4ae618 Mon Sep 17 00:00:00 2001 From: Francois Chollet Date: Fri, 11 Feb 2022 18:35:01 -0800 Subject: [PATCH] Remove deprecated TF1 Layer APIs `apply()`, `get_updates_for()`, `get_losses_for()`, and remove the `inputs` argument in the `add_loss()` method. PiperOrigin-RevId: 428134172 --- .../privacy/optimizers/dp_optimizer_keras_test.py | 2 +- tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras_test.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras_test.py index 590d89f..718684b 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras_test.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_keras_test.py @@ -211,7 +211,7 @@ class DPOptimizerGetGradientsTest(tf.test.TestCase, parameterized.TestCase): name='dense', kernel_initializer='zeros', bias_initializer='zeros') - preds = layer.apply(features) + preds = layer(features) vector_loss = 0.5 * tf.math.squared_difference(labels, preds) scalar_loss = tf.reduce_mean(input_tensor=vector_loss) diff --git a/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py b/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py index c5e368e..cfa9b89 100644 --- a/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py +++ b/tensorflow_privacy/privacy/optimizers/dp_optimizer_test.py @@ -195,7 +195,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)