flashinfer.cake_moe_grouped_gemm_nondet_train.cake_moe_grouped_gemm_nondet_train_dgrad¶
- flashinfer.cake_moe_grouped_gemm_nondet_train.cake_moe_grouped_gemm_nondet_train_dgrad(g: Tensor, w: Tensor, offs: Tensor, out: Tensor | None = None) Tensor¶
dX[offs[e-1]:offs[e]] = G[offs[e-1]:offs[e]] @ W[e]for every groupe.The slice lower bound is
0fore == 0andoffs[e-1]fore > 0. Form_indptrinput,offsin these formulas meansm_indptr[1:].gis[sum_m, N]bfloat16,wis[E, N, K]bfloat16 and is read in place (no transpose copy),offsis[E]int32 device end offsets (orm_indptr[E + 1]) andoutis[sum_m, K]bfloat16.K % 256 == 0andN % 64 == 0are required. The programs are copies of the deterministic package’s and give its bits (no alert under torch’s deterministic mode). Seecake_moe_grouped_gemm_nondet_train_forwardfor the prepared form.- Parameters:
g (torch.Tensor) – BF16
[sum_m, N]packed output-gradient rows.w (torch.Tensor) – BF16
[E, N, K]expert weights, read in place.offs (torch.Tensor) – int32 device cumulative end offsets
[E], or leading-zerom_indptr [E + 1].out (torch.Tensor, optional) – Caller-owned BF16
[sum_m, K]output; allocated when omitted.