flashinfer.cake_causal_conv1d_nondet_train.cake_causal_conv1d_nondet

flashinfer.cake_causal_conv1d_nondet_train.cake_causal_conv1d_nondet(x: Tensor, weight: Tensor, cu_seqlens: Tensor, bias: Tensor | None = None, *, silu_grad_preactivation: str = 'bf16', bwd_grid_mult: int = 1) → Tensor

Autograd-enabled packed width-4 depthwise causal convolution + SiLU, non-deterministic backward.

The package’s autograd Function CakeCausalConv1dNondetFunction, whose backward is one launch with unordered dweight / dbias reductions. When torch’s deterministic mode is on as the backward runs, the backward raises a RuntimeError (a UserWarning, then it runs, with warn_only=True).

Parameters:
  • x (torch.Tensor) – BF16 [S, C] or [1, S, C] contiguous packed activations.

  • weight (torch.Tensor) – FP32 or BF16 [C, 4] contiguous taps.

  • cu_seqlens (torch.Tensor) – int32 [num_docs + 1] device prefix sums of the document lengths.

  • bias (torch.Tensor, optional) – FP32 or BF16 [C] contiguous per-channel bias.

  • silu_grad_preactivation ({"bf16", "fp32"}) – The weight gradient’s SiLU’ policy.

  • bwd_grid_mult ({1, 2, 3, 4}) – The backward’s opt-in finer partition (default 1; see cake_causal_conv1d_nondet_train_backward()); checked at the forward call, used by the backward.

Returns:

BF16 y of x’s shape; the backward saves only x, weight, cu_seqlens and bias and returns the gradients in the parameters’ dtypes.

Return type:

torch.Tensor