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:
parent
560926ea22
commit
085b7ddfec
2 changed files with 3 additions and 2 deletions
|
@ -211,7 +211,7 @@ class DPOptimizerGetGradientsTest(tf.test.TestCase, parameterized.TestCase):
|
||||||
name='dense',
|
name='dense',
|
||||||
kernel_initializer='zeros',
|
kernel_initializer='zeros',
|
||||||
bias_initializer='zeros')
|
bias_initializer='zeros')
|
||||||
preds = layer.apply(features)
|
preds = layer(features)
|
||||||
|
|
||||||
vector_loss = 0.5 * tf.math.squared_difference(labels, preds)
|
vector_loss = 0.5 * tf.math.squared_difference(labels, preds)
|
||||||
scalar_loss = tf.reduce_mean(input_tensor=vector_loss)
|
scalar_loss = tf.reduce_mean(input_tensor=vector_loss)
|
||||||
|
|
|
@ -195,7 +195,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)
|
||||||
|
|
Loading…
Reference in a new issue