SubqOpsCausalConv1d#
- class SubqOpsCausalConv1d(
- in_channels,
- out_channels,
- kernel_size,
- *,
- groups,
- bias=False,
- activation='identity',
Bases:
Conv1dDepthwise causal 1D conv using
subquadratic_ops_torch.causal_conv1d.- Parameters:
- __init__(
- in_channels,
- out_channels,
- kernel_size,
- *,
- groups,
- bias=False,
- activation='identity',
Build a depthwise causal conv with optional SiLU activation.
- Parameters:
in_channels (int) – Channel count (must equal
out_channelsandgroups).out_channels (int) – Output channels (depthwise: same as
in_channels).kernel_size (int) – Causal kernel length.
groups (int) – Must equal
in_channelsfor depthwise layout.bias (bool) – Whether to include a per-channel bias.
activation (str) –
"identity"or"silu"applied inside the CUDA kernel.
- Return type:
None
- forward(input)#
Run causal depthwise conv; input shape
[B, C, L].Casts the weight and bias to
input’s dtype when they differ. The fused kernel selects its specialisation from the INPUT dtype and then requires every tensor to match it exactly, so undertorch.autocast— where activations arrive as bf16/fp16 while parameters stay fp32 — passing the parameters through unchanged raises:ValueError: in_w expected dtype (code=4, bits=16) but got (code=2, bits=32)
Casting here mirrors what autocast does for the built-in conv ops: the fp32 master parameters are untouched, only the values handed to the kernel are narrowed.