| ggml_layer_lstm | R Documentation |
Long Short-Term Memory recurrent layer. Implemented as an unrolled computation graph (BPTT) so that ggml's automatic differentiation works without any C extensions.
ggml_layer_lstm(
model,
units,
return_sequences = FALSE,
activation = "tanh",
recurrent_activation = "sigmoid",
input_shape = NULL,
name = NULL,
trainable = TRUE
)
model |
A |
units |
Integer, number of hidden units. |
return_sequences |
Logical; if |
activation |
Activation for the cell gate (default |
recurrent_activation |
Activation for the recurrent step (default
|
input_shape |
Input shape |
name |
Optional layer name. |
trainable |
Logical. |
Updated model or a new ggml_tensor_node.
W_gates [input_size, 4*units] — input kernel for all
four gates (i, f, g, o) concatenated.
U_gates [units, 4*units] — recurrent kernel.
b_gates [4*units] — bias.
Input: [seq_len, input_size] per sample (R row-major), or a 3-D
array [N, seq_len, input_size]. In the Functional API the input
node shape should be c(seq_len, input_size).
Output (Sequential): [units] per sample when
return_sequences = FALSE (default), or c(seq_len, units)
when return_sequences = TRUE.
model <- ggml_model_sequential() |>
ggml_layer_lstm(64L, input_shape = c(10L, 32L)) |>
ggml_layer_dense(10L, activation = "softmax")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.