Repository: google-parfait/tensorflow-federated

Issue:
Keras model in federated_learning_for_image_classification.ipynb throws warning
**Describe the bug**
Keras Sequential Model in [federated_learning_for_image_classification.ipynb](https://github.com/tensorflow/federated/blob/master/docs/tutorials/federated_learning_for_image_classification.ipynb) throws warning.
The model in the notebook is
```python
def create_keras_model():
  return tf.keras.models.Sequential([
      tf.keras.layers.Input(shape=(784,)),
      tf.keras.layers.Dense(10, kernel_initializer='zeros'),
      tf.keras.layers.Softmax(),
  ])
```
Warning thrown:
```python
WARNING:tensorflow:Please add `keras.layers.InputLayer` instead of `keras.Input` to Sequential model. `keras.Input` is intended to be used by Functional model.
<tensorflow.python.keras.engine.sequential.Sequential at 0x7f66178a46d0>
```

Easily fixed using the correct layer type:
```python
def create_keras_model():
  return tf.keras.models.Sequential([
      tf.keras.layers.InputLayer(input_shape=(784,)),
      tf.keras.layers.Dense(10, kernel_initializer='zeros'),
      tf.keras.layers.Softmax(),
  ])
```

[colab](https://colab.research.google.com/drive/1LFgBiu9xUa-k92IW24fiSX_kVp7lb0SB?usp=sharing) notebook that reproduces the bug.



Discussion:

Resolving patch:
diff --git a/tensorflow_federated/python/examples/remote_execution/remote_executor_example.py b/tensorflow_federated/python/examples/remote_execution/remote_executor_example.py
--- a/tensorflow_federated/python/examples/remote_execution/remote_executor_example.py
+++ b/tensorflow_federated/python/examples/remote_execution/remote_executor_example.py
@@ -114,7 +114,7 @@ def main(argv):
 
   def model_fn():
     model = tf.keras.models.Sequential([
-        tf.keras.layers.Input(shape=(784,)),
+        tf.keras.layers.InputLayer(input_shape=(784,)),
         tf.keras.layers.Dense(10, kernel_initializer='zeros'),
         tf.keras.layers.Softmax(),
     ])


Test patch:
diff --git a/tensorflow_federated/python/learning/federated_evaluation_test.py b/tensorflow_federated/python/learning/federated_evaluation_test.py
--- a/tensorflow_federated/python/learning/federated_evaluation_test.py
+++ b/tensorflow_federated/python/learning/federated_evaluation_test.py
@@ -144,7 +144,7 @@ def aggregate_metrics(client_metrics):
 
 def _model_fn_from_keras():
   keras_model = tf.keras.Sequential([
-      tf.keras.layers.Input(shape=(1,)),
+      tf.keras.layers.InputLayer(input_shape=(1,)),
       tf.keras.layers.Dense(
           1,
           kernel_initializer='ones',
diff --git a/tensorflow_federated/python/learning/keras_utils_test.py b/tensorflow_federated/python/learning/keras_utils_test.py
--- a/tensorflow_federated/python/learning/keras_utils_test.py
+++ b/tensorflow_federated/python/learning/keras_utils_test.py
@@ -379,7 +379,7 @@ def call(self, y_true, y_pred):
 
   def test_tff_model_type_spec_from_keras_model_unspecified_sequence_len(self):
     keras_model = tf.keras.Sequential([
-        tf.keras.layers.Input(shape=(None,)),
+        tf.keras.layers.InputLayer(input_shape=(None,)),
         tf.keras.layers.Embedding(input_dim=10, output_dim=10),
         tf.keras.layers.LSTM(1)
     ])
diff --git a/tensorflow_federated/python/tests/backend_test.py b/tensorflow_federated/python/tests/backend_test.py
--- a/tensorflow_federated/python/tests/backend_test.py
+++ b/tensorflow_federated/python/tests/backend_test.py
@@ -390,7 +390,7 @@ def client_data(n):
 
     def model_fn():
       model = tf.keras.models.Sequential([
-          tf.keras.layers.Input(shape=(input_dim,)),
+          tf.keras.layers.InputLayer(input_shape=(input_dim,)),
           tf.keras.layers.Dense(
               50, activity_regularizer=tf.keras.regularizers.l1(.1)),
           tf.keras.layers.Dense(input_dim, activation='sigmoid'),