|TensorFlow 1 version||View source on GitHub|
Input() is used to instantiate a Keras tensor.
See Migration guide for more details.
tf.keras.Input( shape=None, batch_size=None, name=None, dtype=None, sparse=False, tensor=None, ragged=False, **kwargs )
A Keras tensor is a tensor object from the underlying backend (Theano or TensorFlow), which we augment with certain attributes that allow us to build a Keras model just by knowing the inputs and outputs of the model.
For instance, if a, b and c are Keras tensors,
it becomes possible to do:
model = Model(input=[a, b], output=c)
The added Keras attribute is:
_keras_history: Last layer applied to the tensor.
the entire layer graph is retrievable from that layer,
A shape tuple (integers), not including the batch size.
||optional static batch size (integer).|
||An optional name string for the layer. Should be unique in a model (do not reuse the same name twice). It will be autogenerated if it isn't provided.|
The data type expected by the input, as a string
||A boolean specifying whether the placeholder to be created is sparse. Only one of 'ragged' and 'sparse' can be True.|
Optional existing tensor to wrap into the
||A boolean specifying whether the placeholder to be created is ragged. Only one of 'ragged' and 'sparse' can be True. In this case, values of 'None' in the 'shape' argument represent ragged dimensions. For more information about RaggedTensors, see https://www.tensorflow.org/guide/ragged_tensors|
||deprecated arguments support.|
# this is a logistic regression in Keras x = Input(shape=(32,)) y = Dense(16, activation='softmax')(x) model = Model(x, y)
Note that even if eager execution is enabled,
Input produces a symbolic tensor (i.e. a placeholder).
This symbolic tensor can be used with other
TensorFlow ops, as such:
x = Input(shape=(32,)) y = tf.square(x)
||in case of invalid arguments.|