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
This commit is contained in:
Francois Chollet 2022-02-11 18:35:01 -08:00 committed by A. Unique TensorFlower
parent 560926ea22
commit 085b7ddfec
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -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)