mixed_fftconv1d_fp32_bhl#

mixed_fftconv1d_fp32_bhl(
x,
kernel,
periodic,
shortcut=None,
use_phase_shift=True,
)#

1D mixed-BC FFT convolution (BHL layout).

The single spatial axis can be either periodic (circular) or non-periodic (zero-padded “same”), selected by periodic (length 1).

Parameters:
  • x (Tensor) – Input tensor of shape [B, H, L] (any dtype, internally cast to fp32).

  • kernel (Tensor) – Kernel tensor of shape [1|B, H, K] (any dtype, cast to fp32).

  • periodic (Sequence[bool]) – Length-1 sequence of bools. periodic[0] == True ⇒ circular.

  • shortcut (Tensor | None) – Optional per-channel scale [H] added as y += shortcut * x.

  • use_phase_shift (bool) – If True (default), align periodic axes via frequency-domain phase ramps — the shift is fused into the frequency-domain multiply with no extra data movement, making this the faster path. If False, align via torch.roll() on periodic axes after the inverse transform. The output is mathematically equivalent; use False only as a reference or when torch.compile cannot handle complex ops.

Returns:

Tensor of shape [B, H, L] in the original dtype of x.

Return type:

Tensor