flashinfer.cake_rmsnorm_silu_gate_train.cake_rmsnorm_silu_gate¶
- flashinfer.cake_rmsnorm_silu_gate_train.cake_rmsnorm_silu_gate(x: Tensor, z: Tensor, weight: Tensor, eps: float = 1e-06, *, deterministic: bool = True) Tensor¶
Differentiable
RMSNorm(x) * weight * SiLU(z)over the last dimension (128). Each autograd node saves onlyx,zandweight.deterministic=True(default) isflashinfer.cake_rmsnorm_silu_gate_det_train.cake_rmsnorm_silu_gate_det()(aCakeRMSNormSiLUGateDetFunctionnode): the deterministic package in both directions, its bits.Falseapplies the non-deterministic package’s ownCakeRMSNormSiLUGateFunction(flashinfer.cake_rmsnorm_silu_gate_train_backend), whose weight gradient is summed over the CTAs in a scheduling-dependent order; it is refused whiletorch.use_deterministic_algorithms(True)is in effect (withwarn_only=True: a warning, then the deterministic node). The backward of aFalsenode raises PyTorch’s alert if the deterministic algorithms are enabled by the time it runs andweightneeds a gradient (RuntimeError; underwarn_only=TrueaUserWarning, then the non-deterministic backward). A non-reentrant checkpoint replays the forward through this function with the same flag.- Parameters:
x (torch.Tensor) – BF16
[..., 128]input ([T, H, 128]or[T * H, 128]).z (torch.Tensor) – BF16 gate input of the same shape as
x.weight (torch.Tensor) – BF16
[128]weight shared by every token and head.eps (float) – Variance epsilon (FP32 inside the kernel).
deterministic (bool) –
True(default) applies the deterministic node,Falsethe non-deterministic one (see above).
- Returns:
BF16
yofx’s shape.- Return type:
torch.Tensor