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 unordereddweight/dbiasreductions. When torch’s deterministic mode is on as the backward runs, the backward raises aRuntimeError(aUserWarning, then it runs, withwarn_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
yofx’s shape; the backward saves onlyx,weight,cu_seqlensandbiasand returns the gradients in the parameters’ dtypes.- Return type:
torch.Tensor