| ggml_layer_rms_norm | R Documentation |
Normalizes each sample by the root mean square of its features, then scales
by gamma and shifts by beta (both learnable). Unlike
ggml_layer_batch_norm it does not subtract the mean and keeps
no running statistics, so it behaves identically in training and inference
and does not couple the samples in a batch. This is the normalization used
by transformer blocks.
ggml_layer_rms_norm(model, eps = 1e-05, name = NULL, trainable = TRUE)
model |
A |
eps |
Small constant for numerical stability (default 1e-5) |
name |
Optional character name for the layer. |
trainable |
Logical; whether the layer weights are updated during training. |
The model with the layer appended, or a new ggml_tensor_node
in the functional API.
ggml_layer_batch_norm
# Functional API: the normalization of a transformer block.
x <- ggml_input(shape = c(10L, 32L))
h <- x |> ggml_layer_rms_norm()
h <- h |> ggml_layer_attention(d_model = 32L, n_heads = 4L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.