ggml_rwkv_wkv6_back: Backward Pass of the RWKV-6 WKV Recurrence

View source: R/operations.R

ggml_rwkv_wkv6_backR Documentation

Backward Pass of the RWKV-6 WKV Recurrence

Description

Gradients of ggml_rwkv_wkv6 with respect to all six of its inputs, given grad, the gradient of the loss with respect to the recurrence's packed forward result.

Usage

ggml_rwkv_wkv6_back(ctx, k, v, r, tf, td, state, grad)

Arguments

ctx

GGML context

k, v, r, tf, td, state

The tensors passed to the forward recurrence

grad

Gradient w.r.t. the packed forward result

Details

Training reaches this automatically through the backward graph; it is exported so the gradient can be checked against a numeric one.

Value

A flat tensor holding the six gradients, concatenated

Packed result

All six gradients come back in one flat tensor, in the order the forward op takes its inputs: [d_k | d_v | d_r | d_tf | d_td | d_state].

See Also

ggml_rwkv_wkv6

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


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