What is the advantage of using an InputLayer (or an Input) in a Keras model with Tensorflow tensors? : <p>A Keras model can used as a Tensorflow function on a Tensor, through the functional API, as described <a href="https://blog.keras.io/keras-as-a-simplified-interface-to-tensorflow-tutorial.html#calling-keras-layers-on-tensorflow-tensors%20here" rel="noreferrer">here</a>.</p>

<p>So we can do:</p>

<pre><code>from keras.layers import InputLayer

a = tf.placeholder(dtype=tf.float32, shape=(None, 784))

model = Sequential()
model.add(InputLayer(input_tensor=a, input_shape=(None, 784)))
model.add(Dense(32, activation='relu'))
model.add(Dense(10, activation='softmax'))

output = model.output
</code></pre>

<p>Which is a tensor:</p>

<pre><code>&lt;tf.Tensor 'dense_24/Softmax:0' shape=(?, 10) dtype=float32&gt;
</code></pre>

<p>But, this also works without any <code>InputLayer</code>:</p>

<pre><code>a = tf.placeholder(dtype=tf.float32, shape=(None, 784))

model = Sequential()
model.add(Dense(32, activation='relu', input_shape=(784,)))
model.add(Dense(10, activation='softmax'))

output = model(a)
</code></pre>

<p>works, and <code>output</code> has the same shape as before:</p>

<pre><code>&lt;tf.Tensor 'sequential_9/dense_22/Softmax:0' shape=(?, 10) dtype=float32&gt;
</code></pre>

<p>I assume the first form permits:</p>

<ul>
<li>to explicitely attach the <code>inputs</code> and <code>outputs</code> as attributes of the model (of the same names), so we can reuse them elsewhere. For example with other TF ops.</li>
<li>to transform the tensors given as inputs into Keras inputs, with additional metadata (such as <code>_keras_history</code> as stated in <a href="https://github.com/fchollet/keras/blob/master/keras/engine/topology.py#L1369-L1372" rel="noreferrer">the source code</a>).</li>
</ul>

<p>But this is not something we cannot do with the second form, so, is there a special usage of the <code>InputLayer</code> (and <code>Input</code> a fortiori) (except for multiple inputs)?<br>
Moreover, the <code>InputLayer</code> is tricky because it's using <code>input_shape</code> differently from other keras layers: we specify the batch size (<code>None</code> here), which is not usually the case...</p>
