@@ -90,7 +90,7 @@ class Dense(keras_layers.Dense, base.Layer):
90
90
91
91
Please refer to [tf.layers section of the migration guide]
92
92
(https://www.tensorflow.org/guide/migrate#models_based_on_tflayers)
93
- for more details on migrating a TF1 model to Keras. In TF2 the corresponding
93
+ to migrate a TensorFlow v1 model to Keras. The corresponding TensorFlow v2
94
94
layer is `tf.keras.layers.Dense`.
95
95
96
96
@@ -206,7 +206,7 @@ def dense(
206
206
207
207
Please refer to [tf.layers section of the migration guide]
208
208
(https://www.tensorflow.org/guide/migrate#models_based_on_tflayers)
209
- for more details on migrating a TF1 model to Keras. In TF2 the corresponding
209
+ to migrate a TensorFlow v1 model to Keras. The corresponding TensorFlow v2
210
210
layer is `tf.keras.layers.Dense`.
211
211
212
212
@@ -222,8 +222,13 @@ def dense(
222
222
223
223
After:
224
224
225
+ To migrate code using TF1 functional layers use the [Keras Functional API]
226
+ (https://www.tensorflow.org/guide/keras/functional):
227
+
225
228
```python
229
+ x = tf.keras.Input((28,))
226
230
y = tf.keras.layers.Dense(units=3)(x)
231
+ model = tf.keras.Model(x, y)
227
232
```
228
233
@end_compatibility
229
234
@@ -278,7 +283,7 @@ class Dropout(keras_layers.Dropout, base.Layer):
278
283
279
284
Please refer to [tf.layers section of the migration guide]
280
285
(https://www.tensorflow.org/guide/migrate#models_based_on_tflayers)
281
- for more details on migrating a TF1 model to Keras. In TF2 the corresponding
286
+ to migrate a TensorFlow v1 model to Keras. The corresponding TensorFlow v2
282
287
layer is `tf.keras.layers.Dropout`.
283
288
284
289
@@ -359,7 +364,7 @@ def dropout(inputs,
359
364
360
365
Please refer to [tf.layers section of the migration guide]
361
366
(https://www.tensorflow.org/guide/migrate#models_based_on_tflayers)
362
- for more details on migrating a TF1 model to Keras. In TF2 the corresponding
367
+ to migrate a TensorFlow v1 model to Keras. The corresponding TensorFlow v2
363
368
layer is `tf.keras.layers.Dropout`.
364
369
365
370
@@ -375,8 +380,13 @@ def dropout(inputs,
375
380
376
381
After:
377
382
383
+ To migrate code using TF1 functional layers use the [Keras Functional API]
384
+ (https://www.tensorflow.org/guide/keras/functional):
385
+
378
386
```python
387
+ x = tf.keras.Input((28, 28, 1))
379
388
y = tf.keras.layers.Dropout()(x)
389
+ model = tf.keras.Model(x, y)
380
390
```
381
391
@end_compatibility
382
392
"""
@@ -416,7 +426,7 @@ class Flatten(keras_layers.Flatten, base.Layer):
416
426
417
427
Please refer to [tf.layers section of the migration guide]
418
428
(https://www.tensorflow.org/guide/migrate#models_based_on_tflayers)
419
- for more details on migrating a TF1 model to Keras. In TF2 the corresponding
429
+ to migrate a TensorFlow v1 model to Keras. The corresponding TensorFlow v2
420
430
layer is `tf.keras.layers.Flatten`.
421
431
422
432
@@ -474,7 +484,7 @@ def flatten(inputs, name=None, data_format='channels_last'):
474
484
475
485
Please refer to [tf.layers section of the migration guide]
476
486
(https://www.tensorflow.org/guide/migrate#models_based_on_tflayers)
477
- for more details on migrating a TF1 model to Keras. In TF2 the corresponding
487
+ to migrate a TensorFlow v1 model to Keras. The corresponding TensorFlow v2
478
488
layer is `tf.keras.layers.Flatten`.
479
489
480
490
@@ -490,8 +500,13 @@ def flatten(inputs, name=None, data_format='channels_last'):
490
500
491
501
After:
492
502
503
+ To migrate code using TF1 functional layers use the [Keras Functional API]
504
+ (https://www.tensorflow.org/guide/keras/functional):
505
+
493
506
```python
507
+ x = tf.keras.Input((28, 28, 1))
494
508
y = tf.keras.layers.Flatten()(x)
509
+ model = tf.keras.Model(x, y)
495
510
```
496
511
@end_compatibility
497
512
"""
0 commit comments