Add a warning message for usage of feeding keras.Input() to sequential model.
The keras.Input() is designed for functional model, and might cause some use confusion when calling model.summary() or plot the model. See https://github.com/tensorflow/tensorflow/issues/45437 for more information. PiperOrigin-RevId: 346877064 Change-Id: I20264fc966e9651c24a7a99b65173ad7e814fc1e
This commit is contained in:
parent
e5ffdb506b
commit
4b7f5e46d8
@ -178,6 +178,10 @@ class Sequential(functional.Functional):
|
||||
origin_layer = layer._keras_history[0]
|
||||
if isinstance(origin_layer, input_layer.InputLayer):
|
||||
layer = origin_layer
|
||||
logging.warning(
|
||||
'Please add `keras.layers.InputLayer` instead of `keras.Input` to '
|
||||
'Sequential model. `keras.Input` is intended to be used by '
|
||||
'Functional model.')
|
||||
|
||||
if isinstance(layer, module.Module):
|
||||
if not isinstance(layer, base_layer.Layer):
|
||||
|
Loading…
Reference in New Issue
Block a user