View source: R/nn_functional.R
| ggml_apply | R Documentation |
Applies a ggml_layer object (created with ggml_dense(),
ggml_lstm(), etc.) to a ggml_tensor_node. Applying the
same layer object to multiple tensor nodes produces shared weights –
the identity of the layer object (layer$layer_id) is used as the
sharing key, not its name.
ggml_apply(tensor, layer)
tensor |
A |
layer |
A |
A new ggml_tensor_node.
encoder <- ggml_dense(64L, activation = "relu")
x1 <- ggml_input(shape = 32L)
x2 <- ggml_input(shape = 32L)
out1 <- x1 |> ggml_apply(encoder)
out2 <- x2 |> ggml_apply(encoder) # shared weights
model <- ggml_model(inputs = list(x1, x2),
outputs = list(out1, out2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.