keras_input {keras3} | R Documentation |
Create a Keras tensor (Functional API input).
Description
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 <- keras_model(input = c(a, b), output = c)
Usage
keras_input(
shape = NULL,
batch_size = NULL,
dtype = NULL,
sparse = NULL,
batch_shape = NULL,
name = NULL,
tensor = NULL,
optional = FALSE
)
Arguments
shape |
A shape list (list of integers or |
batch_size |
Optional static batch size (integer). |
dtype |
The data type expected by the input, as a string
(e.g. |
sparse |
A boolean specifying whether the expected input will be sparse
tensors. Note that, if |
batch_shape |
Shape, including the batch dim. |
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 |
optional |
Boolean, whether the input is optional or not.
An optional input can accept |
Value
A Keras tensor,
which can passed to the inputs
argument of (keras_model()
).
Examples
# This is a logistic regression in Keras input <- layer_input(shape=c(32)) output <- input |> layer_dense(16, activation='softmax') model <- keras_model(input, output)
See Also
Other model creation:
keras_model()
keras_model_sequential()