| ggml_compile.ggml_functional_model | R Documentation |
Configures the model for training: infers shapes, creates backend. Weight tensors are created at training time when batch_size is known.
## S3 method for class 'ggml_functional_model'
ggml_compile(
model,
optimizer = "adam",
loss = "categorical_crossentropy",
metrics = c("accuracy"),
backend = "auto",
loss_weights = NULL,
weight_decay = 0,
predict_precision = "default"
)
ggml_compile(
model,
optimizer = "adam",
loss = "categorical_crossentropy",
metrics = c("accuracy"),
backend = "auto",
loss_weights = NULL,
weight_decay = 0,
predict_precision = "default"
)
## S3 method for class 'ggml_sequential_model'
ggml_compile(
model,
optimizer = "adam",
loss = "categorical_crossentropy",
metrics = c("accuracy"),
backend = "auto",
loss_weights = NULL,
weight_decay = 0,
predict_precision = "default"
)
model |
A ggml_sequential_model object |
optimizer |
Optimizer name: "adam" or "sgd" |
loss |
Loss function name: |
metrics |
Character vector of metrics to report from
|
backend |
Backend to use: "auto" (GPU if available, else CPU), "cpu", or "vulkan" |
loss_weights |
Optional per-output weights for a multi-output model;
the optimized total is |
weight_decay |
Decoupled weight decay for the optimizer, in |
predict_precision |
Matrix-multiply precision for prediction:
|
The compiled model (invisibly).
model <- ggml_model_sequential() |>
ggml_layer_conv_2d(32, c(3,3), activation = "relu",
input_shape = c(28, 28, 1)) |>
ggml_layer_max_pooling_2d(c(2, 2)) |>
ggml_layer_flatten() |>
ggml_layer_dense(10, activation = "softmax")
model <- ggml_compile(model, optimizer = "adam",
loss = "categorical_crossentropy")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.