flashinfer.cake_rmsnorm_train.cake_rmsnorm¶
- flashinfer.cake_rmsnorm_train.cake_rmsnorm(x: Tensor, w: Tensor, eps: float = 1e-06, residual: Tensor | None = None, deterministic: bool = True)¶
Autograd-enabled fused BF16 RMSNorm (optionally with a fused residual add).
- Parameters:
x (torch.Tensor) – BF16
[T, H]input on a supported CUDA device.w (torch.Tensor) – BF16
[H]RMSNorm weight.eps (float) – Variance epsilon evaluated in FP32 by the kernel.
residual (torch.Tensor, optional) – BF16
[T, H]update added toxbefore normalization. When provided, the normalized inputh_newis returned with the output.deterministic (bool) – Whether to use the deterministic fixed-order weight-gradient reduction. Only
Trueis supported;Falseis rejected during backward.
- Returns:
BF16
ywith shape[T, H], or(y, h_new)whenresidualis given. Backward launches the fuseddxand deterministicdwkernels ofcake_rmsnorm_train_backward().- Return type:
torch.Tensor or tuple[torch.Tensor, torch.Tensor]