Skip to content

Causal Conv1d kernel #27

Description

@superposition

Description

Causal 1D convolution for temporal sequence modeling.

Operation

# Causal conv: only looks at past
# x: (B, D, T) → (B, D_out, T)
output = causal_conv1d(x, weight, bias=None)

Implementation

  • Left-padded convolution (no future leakage)
  • Fused with optional activation (SiLU for Mamba)
  • Support for depthwise separable variant
  • Efficient for small kernel sizes (3, 4, 7)

Tests

  • Output at time t only depends on inputs ≤ t
  • Matches F.conv1d with proper padding
  • Gradient flows correctly
  • gradcheck passes
  • Fused activation produces correct result
  • Works with various kernel sizes

Used In

WaveNet, Mamba, S4, temporal world models, TCN

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions