From b08420591d6418a31788b7ea8de06f2816ff0e0c Mon Sep 17 00:00:00 2001 From: Francois Chollet Date: Mon, 10 Jul 2023 10:41:04 -0700 Subject: [PATCH] Add Input docstring --- keras_core/layers/core/input_layer.py | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/keras_core/layers/core/input_layer.py b/keras_core/layers/core/input_layer.py index 81382f0c6..3f2748c3f 100644 --- a/keras_core/layers/core/input_layer.py +++ b/keras_core/layers/core/input_layer.py @@ -84,6 +84,45 @@ def Input( 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)` + + Args: + shape: A shape tuple (tuple of integers or `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). + batch_size: Optional static batch size (integer). + dtype: The data type expected by the input, as a string + (e.g. `"float32"`, `"int32"`...) + name: 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. + tensor: Optional existing tensor to wrap into the `Input` layer. + If set, the layer will use this tensor rather + than creating a new placeholder tensor. + + Returns: + A Keras tensor. + + Example: + + ```python + # This is a logistic regression in Keras + x = Input(shape=(32,)) + y = Dense(16, activation='softmax')(x) + model = Model(x, y) + ``` + """ layer = InputLayer( shape=shape, batch_size=batch_size,