| keras_model {keras3} | R Documentation |
Keras Model (Functional API)
Description
A model is a directed acyclic graph of layers.
Usage
keras_model(inputs = NULL, outputs = NULL, ...)
Arguments
inputs |
Input tensor(s) (from |
outputs |
Output tensors (from calling layers with |
... |
Any additional arguments |
Value
A Model instance.
Examples
library(keras3)
# input tensor
inputs <- keras_input(shape = c(784))
# outputs compose input + dense layers
predictions <- inputs |>
layer_dense(units = 64, activation = 'relu') |>
layer_dense(units = 64, activation = 'relu') |>
layer_dense(units = 10, activation = 'softmax')
# create and compile model
model <- keras_model(inputs = inputs, outputs = predictions)
model |> compile(
optimizer = 'rmsprop',
loss = 'categorical_crossentropy',
metrics = c('accuracy')
)
See Also
Other model functions:
get_config()
get_layer()
keras_model_sequential()
pop_layer()
summary.keras.src.models.model.Model()
Other model creation:
keras_input()
keras_model_sequential()
[Package keras3 version 1.1.0 Index]