# \donttest{
# Mish activation: x * tanh(softplus(x))
layer_mish <- ggml_layer_custom(
name = "mish",
forward = function(ctx, x) ggml_mul(ctx, x, ggml_tanh(ctx, ggml_softplus(ctx, x)))
)
inp <- ggml_input(shape = 8L)
out <- inp |>
ggml_layer_dense(16L) |>
layer_mish() |>
ggml_layer_dense(2L, activation = "softmax")
model <- ggml_model(inputs = inp, outputs = out)
# }
Run the code above in your browser using DataLab