Function ctc_grad_from_alpha_beta_default
pub fn ctc_grad_from_alpha_beta_default<B>(
log_probs: <B as BackendTypes>::FloatTensorPrimitive,
targets: <B as BackendTypes>::IntTensorPrimitive,
input_lengths: <B as BackendTypes>::IntTensorPrimitive,
grad_loss: <B as BackendTypes>::FloatTensorPrimitive,
log_alpha_full: <B as BackendTypes>::FloatTensorPrimitive,
log_beta_full: <B as BackendTypes>::FloatTensorPrimitive,
nll: <B as BackendTypes>::FloatTensorPrimitive,
blank: usize,
) -> <B as BackendTypes>::FloatTensorPrimitivewhere
B: Backend,Expand description
Compose the CTC gradient w.r.t. log_probs from pre-computed alpha, beta, and nll.
The T-iteration alpha and beta recursions are the dominant cost of the backward pass. Backends that fuse those recursions into a single kernel launch can call this helper to reuse the gradient composition.
ยงArguments
log_probs- Log-probabilities[T, N, C]targets- Target label indices[N, S]input_lengths- Actual input sequence lengths per batch element[N]grad_loss- Upstream gradient w.r.t. the per-sample loss[N]log_alpha_full- Alpha recursion output[T, N, 2S+1]log_beta_full- Beta recursion output[T, N, 2S+1]nll- Per-sample negative log-likelihood (forward loss)[N]blank- Index of the blank label