Input
functionkeras.Input(
shape=None,
batch_size=None,
dtype=None,
sparse=None,
batch_shape=None,
name=None,
tensor=None,
)
Used to instantiate a Keras tensor.
A Keras tensor is a symbolic tensor-like object, 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)
Arguments
None
objects),
not including the batch size.
For instance, shape=(32,)
indicates that the expected input
will be batches of 32-dimensional vectors. Elements of this tuple
can be None
; None
elements represent dimensions where the shape
is not known and may vary (e.g. sequence length)."float32"
, "int32"
...)sparse
is False
, sparse tensors can still
be passed into the input - they will be densified with a default
value of 0. This feature is only supported with the TensorFlow
backend. Defaults to False
.Input
layer.
If set, the layer will use this tensor rather
than creating a new placeholder tensor.Returns
A Keras tensor.
Example
# This is a logistic regression in Keras
x = Input(shape=(32,))
y = Dense(16, activation='softmax')(x)
model = Model(x, y)