flashinfer.cake_mhc_nondet_train.cake_mhc_nondet_train_prepare¶
- flashinfer.cake_mhc_nondet_train.cake_mhc_nondet_train_prepare(X: Tensor, fn: Tensor, scale: Tensor, base: Tensor, *, rms_eps: float = 1e-05, hc_eps: float = 1e-06, sinkhorn_iters: int = 20, save_stats: bool = True, workspace: Tensor | None = None, backward_workspace: Tensor | None = None)¶
Autograd-enabled
forward_prepare:(U, handle); passhandletocake_mhc_nondet_train_finish().The arguments and outputs are those of
cake_mhc_det_train_prepare(); the call makes the backend package’s prepare node. Its forward and its checkpoint replay are the deterministic package’s bits; its backward runsbackward_finish(seecake_mhc_nondet_train_backward_finish()).- Parameters:
X (torch.Tensor) – As in
cake_mhc_nondet_train_forward_prepare()(Xand the parameters may require gradients).fn (torch.Tensor) – As in
cake_mhc_nondet_train_forward_prepare()(Xand the parameters may require gradients).scale (torch.Tensor) – As in
cake_mhc_nondet_train_forward_prepare()(Xand the parameters may require gradients).base (torch.Tensor) – As in
cake_mhc_nondet_train_forward_prepare()(Xand the parameters may require gradients).rms_eps (float, float, int) – As in
cake_mhc_nondet_train_forward_prepare().hc_eps (float, float, int) – As in
cake_mhc_nondet_train_forward_prepare().sinkhorn_iters (float, float, int) – As in
cake_mhc_nondet_train_forward_prepare().save_stats (bool) –
True(default): the per-token statistics are kept for the backward.False: they are recomputed fromXin the backward (checkpoint replay), bit for bit the saved record.workspace (torch.Tensor, optional) – Caller-owned forward workspace (
hidden=X.shape[2]); a per-device default when omitted.backward_workspace (torch.Tensor, optional) – Caller-owned backward workspace of
cake_mhc_nondet_train_backward_workspace(); a per-device default when omitted.
- Returns:
(U, handle): BF16Uof shape[T, H]and the handle of this prepare node for onecake_mhc_nondet_train_finish().- Return type:
tuple