flashinfer.cake_mhc_nondet_train.cake_mhc_nondet_train_forward_finish

flashinfer.cake_mhc_nondet_train.cake_mhc_nondet_train_forward_finish(X: Tensor, B: Tensor, stats: Tensor, *, out: Tensor | None = None) → Tensor

Residual mixing: Y[t, j, d] = BF16(post[t, j] B[t, d] + sum_i C[t, i, j] X[t, i, d]).

The arguments and output are those of cake_mhc_det_train_forward_finish(); the call runs the backend package (the deterministic package’s bits).

Parameters:
  • X (torch.Tensor) – BF16 [T, 4, H] contiguous residual streams (the forward_prepare input).

  • B (torch.Tensor) – BF16 [T, H] contiguous output of the external branch applied to U.

  • stats (torch.Tensor) – FP32 [T, 64] record of cake_mhc_nondet_train_forward_prepare() (or cake_mhc_nondet_train_forward_stats()).

  • out (torch.Tensor, optional) – Preallocated BF16 [T, 4, H] contiguous Y.

Returns:

BF16 Y of shape [T, 4, H].

Return type:

torch.Tensor