MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Input

Function Input

tensorflow/python/keras/engine/input_layer.py:163–273  ·  view source on GitHub ↗

`Input()` is used to instantiate a Keras tensor. 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

(  # pylint: disable=invalid-name
    shape=None,
    batch_size=None,
    name=None,
    dtype=None,
    sparse=False,
    tensor=None,
    ragged=False,
    **kwargs)

Source from the content-addressed store, hash-verified

161
162@keras_export('keras.layers.Input', 'keras.Input')
163def Input( # pylint: disable=invalid-name
164 shape=None,
165 batch_size=None,
166 name=None,
167 dtype=None,
168 sparse=False,
169 tensor=None,
170 ragged=False,
171 **kwargs):
172 """`Input()` is used to instantiate a Keras tensor.
173
174 A Keras tensor is a tensor object from the underlying backend
175 (Theano or TensorFlow), which we augment with certain
176 attributes that allow us to build a Keras model
177 just by knowing the inputs and outputs of the model.
178
179 For instance, if a, b and c are Keras tensors,
180 it becomes possible to do:
181 `model = Model(input=[a, b], output=c)`
182
183 The added Keras attribute is:
184 `_keras_history`: Last layer applied to the tensor.
185 the entire layer graph is retrievable from that layer,
186 recursively.
187
188 Arguments:
189 shape: A shape tuple (integers), not including the batch size.
190 For instance, `shape=(32,)` indicates that the expected input
191 will be batches of 32-dimensional vectors. Elements of this tuple
192 can be None; 'None' elements represent dimensions where the shape is
193 not known.
194 batch_size: optional static batch size (integer).
195 name: An optional name string for the layer.
196 Should be unique in a model (do not reuse the same name twice).
197 It will be autogenerated if it isn't provided.
198 dtype: The data type expected by the input, as a string
199 (`float32`, `float64`, `int32`...)
200 sparse: A boolean specifying whether the placeholder to be created is
201 sparse. Only one of 'ragged' and 'sparse' can be True.
202 tensor: Optional existing tensor to wrap into the `Input` layer.
203 If set, the layer will not create a placeholder tensor.
204 ragged: A boolean specifying whether the placeholder to be created is
205 ragged. Only one of 'ragged' and 'sparse' can be True. In this case,
206 values of 'None' in the 'shape' argument represent ragged dimensions.
207 For more information about RaggedTensors, see
208 https://www.tensorflow.org/guide/ragged_tensors.
209 **kwargs: deprecated arguments support. Supports `batch_shape` and
210 `batch_input_shape`.
211
212 Returns:
213 A `tensor`.
214
215 Example:
216
217 ```python
218 # this is a logistic regression in Keras
219 x = Input(shape=(32,))
220 y = Dense(16, activation='softmax')(x)

Callers 2

_clone_functional_modelFunction · 0.90
_clone_sequential_modelFunction · 0.90

Calls 4

InputLayerClass · 0.70
popMethod · 0.45
updateMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected