ggml_ssm_conv_back: Backward Pass of the State-Space Convolution

View source: R/operations.R

ggml_ssm_conv_backR Documentation

Backward Pass of the State-Space Convolution

Description

Gradients of ggml_ssm_conv with respect to both of its inputs, given grad, the gradient of the loss with respect to the convolution's output.

Usage

ggml_ssm_conv_back(ctx, sx, c, grad)

Arguments

ctx

GGML context

sx

The sx passed to the forward convolution

c

The c passed to the forward convolution

grad

Gradient w.r.t. the output, shaped like it: [d_inner, n_t, n_s]

Details

Training reaches this automatically through the backward graph – an ggml_ssm_conv node is differentiable, unlike the other state-space and RWKV ops. It is exported so the gradient can be checked directly against a numeric one.

Value

A flat tensor holding d_sx followed by d_c

Packed result

Both gradients come back in one flat tensor, [d_sx | d_c]: the first ggml_nelements(sx) elements are the gradient with respect to sx, the remaining ggml_nelements(c) the gradient with respect to c. A single op returns a single tensor, and packing them keeps the convolution from being run once per input.

See Also

ggml_ssm_conv

Other state-space: ggml_gated_linear_attn(), ggml_gated_linear_attn_back(), ggml_rwkv_output(), ggml_rwkv_wkv6(), ggml_rwkv_wkv6_back(), ggml_rwkv_wkv7(), ggml_rwkv_wkv7_back(), ggml_ssm_conv(), ggml_ssm_scan(), ggml_ssm_scan_back(), ggml_ssm_scan_output()


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