{"id":26821,"library":"causal-conv1d","title":"causal-conv1d","description":"Causal depthwise 1D convolution CUDA kernel with PyTorch interface, commonly used as a building block for state-space models like Mamba. Current version: 1.6.1. Active development; breaking API changes between v1.x versions.","status":"active","version":"1.6.1","language":"python","source_language":"en","source_url":"https://github.com/Dao-AILab/causal-conv1d","tags":["conv1d","causal","cuda","pytorch","state-space-models","mamba"],"install":[{"cmd":"pip install causal-conv1d","lang":"bash","label":"PyPI installation (CUDA required at runtime)"}],"dependencies":[{"reason":"Core dependency; provides tensor types and CUDA support","package":"torch","optional":false}],"imports":[{"note":"Not a submodule; direct import from package top-level.","wrong":"from causal_conv1d.causal_conv1d import causal_conv1d_fn","symbol":"causal_conv1d_fn","correct":"from causal_conv1d import causal_conv1d_fn"},{"note":"CausalConv1d class never existed; use CausalConv1dFn.","wrong":"from causal_conv1d import CausalConv1d","symbol":"CausalConv1dFn","correct":"from causal_conv1d import CausalConv1dFn"}],"quickstart":{"code":"import torch\nfrom causal_conv1d import causal_conv1d_fn\n\nx = torch.randn(2, 64, 128, device='cuda')\nweight = torch.randn(64, 3, device='cuda')  # depthwise, kernel_size=3\nbias = torch.randn(64, device='cuda')\nout = causal_conv1d_fn(x, weight, bias, activation='silu')\nprint(out.shape)  # torch.Size([2, 64, 128])","lang":"python","description":"Basic usage: apply causal depthwise conv1d on CUDA tensor."},"warnings":[{"fix":"Update calls: use activation='silu' (or None) and remove dims from kwargs.","message":"In v1.4.0, the function signature changed: activation parameter must be passed as a string (e.g., 'silu') instead of None or torch.nn.SiLU. Also dims argument was removed.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Move tensors to CUDA: x = x.cuda() before calling causal_conv1d_fn.","message":"The kernel only supports CUDA. Passing CPU tensors will raise a RuntimeError. Always ensure inputs are on CUDA device.","severity":"gotcha","affected_versions":"all"},{"fix":"Verify weight shape: weight.shape should be (C, K) where C is channels and K is kernel size (odd).","message":"Weight tensor must be 2D (out_channels, kernel_size) for depthwise convolution. Using 1D or transposed dimensions causes silent shape errors or kernel launch failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Change import to: from causal_conv1d import causal_conv1d_fn","message":"The old import path causal_conv1d.causal_conv1d_interface is deprecated since v1.2.0. Use causal_conv1d directly.","severity":"deprecated","affected_versions":">=1.2.0"}],"env_vars":null,"search_vec":"'1.6.1':28 '1d':6 'activ':29 'api':32 'block':18 'break':31 'build':17 'causal':2,4,38 'causal-conv1d':1 'chang':33 'common':13 'conv1d':3,37 'convolut':7 'cuda':8,39 'current':26 'depthwis':5 'develop':30 'interfac':12 'kernel':9 'like':24 'mamba':25,45 'model':23,44 'pytorch':11,40 'space':22,43 'state':21,42 'state-spac':20 'state-space-model':41 'use':14 'v1.x':35 'version':27,36","created_at":"2026-05-01T17:43:03.097200+00:00","updated_at":"2026-05-01T17:43:03.097200+00:00","problems":{"verify_error":"× Failed to build `causal-conv1d==1.6.2.post1`\n  ├─▶ The build backend returned an error\n  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)\n\n      [stdout]\n\n\n      torch.__version__  = 2.10.0+cu128\n\n\n\n      [stderr]\n      /home/xor/.cache/uv/builds-v0/.tmp6yZgnD/lib/python3.12"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Dao-AILab/causal-conv1d","docs":null,"changelog":null,"pypi":"https://pypi.org/project/causal-conv1d/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["llm-agents","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}