Remove usage of deprecated layer method.

PiperOrigin-RevId: 427339701
This commit is contained in:
Francois Chollet 2022-02-08 17:45:19 -08:00 committed by A. Unique TensorFlower
parent bb153c1f9d
commit cd38172f35
2 changed files with 3 additions and 2 deletions

View file

@ -132,7 +132,8 @@ class DPOptimizerTest(tf.test.TestCase, parameterized.TestCase):
def linear_model_fn(features, labels, mode): def linear_model_fn(features, labels, mode):
preds = tf.keras.layers.Dense( 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) vector_loss = tf.math.squared_difference(labels, preds)
scalar_loss = tf.reduce_mean(input_tensor=vector_loss) scalar_loss = tf.reduce_mean(input_tensor=vector_loss)

View file

@ -41,7 +41,7 @@ class UtilsTest(absltest.TestCase):
del labels del labels
input_layer = tf.reshape(features['x'], [-1, self.ndim]) 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 # Define the PREDICT mode becasue we only need that
if mode == tf.estimator.ModeKeys.PREDICT: if mode == tf.estimator.ModeKeys.PREDICT: