nn_layer_norm_core: Layer-normalize over the feature axis

View source: R/nn_layers.R

nn_layer_norm_coreR Documentation

Layer-normalize over the feature axis

Description

ggml_norm() normalizes over ne[0] – the feature axis for every input rank the layers use – keeping the sequence and batch axes, so one call covers flat and sequence inputs alike. Upstream ggml has no backward rule for it; ggmlR adds GGML_OP_NORM_BACK (CPU and Vulkan kernels), so a graph using this is trainable.

Usage

nn_layer_norm_core(ctx, x, eps)

Arguments

ctx

A ggml_context.

x

A ggml_tensor whose features lie along ne[0].

eps

Small constant added to the variance.

Value

A ggml_tensor of the same shape as x.


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.