# Causal depthwise conv1d in CUDA with a PyTorch interface
Features:
- Support fp32, fp16, bf16.
- Kernel size 2, 3, 4.
## How to use
```
from causal_conv1d import causal_conv1d_fn
```
```
def causal_conv1d_fn(x, weight, bias=None, activation=None):
"""
x: (batch, dim, seqlen)
weight: (dim, width)
bias: (dim,)
activation: either None or "silu" or "swish"
out: (batch, dim, seqlen)
"""
```
Equivalent to:
```
import torch.nn.functional as F
F.conv1d(x, weight.unsqueeze(1), bias, padding=width - 1, groups=dim)[..., :seqlen]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Dao-AILab/causal-conv1d",
"name": "causal-conv1d",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Tri Dao",
"author_email": "tri@tridao.me",
"download_url": "https://files.pythonhosted.org/packages/51/e8/ad8c4be8207a3b46bf7161f2af9be8b95d8bfb7195779e1b9c411c48c1b4/causal_conv1d-1.2.2.post1.tar.gz",
"platform": null,
"description": "# Causal depthwise conv1d in CUDA with a PyTorch interface\n\nFeatures:\n- Support fp32, fp16, bf16.\n- Kernel size 2, 3, 4.\n\n## How to use\n\n```\nfrom causal_conv1d import causal_conv1d_fn\n```\n\n```\ndef causal_conv1d_fn(x, weight, bias=None, activation=None):\n \"\"\"\n x: (batch, dim, seqlen)\n weight: (dim, width)\n bias: (dim,)\n activation: either None or \"silu\" or \"swish\"\n\n out: (batch, dim, seqlen)\n \"\"\"\n```\n\nEquivalent to:\n```\nimport torch.nn.functional as F\n\nF.conv1d(x, weight.unsqueeze(1), bias, padding=width - 1, groups=dim)[..., :seqlen]\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Causal depthwise conv1d in CUDA, with a PyTorch interface",
"version": "1.2.2.post1",
"project_urls": {
"Homepage": "https://github.com/Dao-AILab/causal-conv1d"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "51e8ad8c4be8207a3b46bf7161f2af9be8b95d8bfb7195779e1b9c411c48c1b4",
"md5": "412d6af1f5ae76153d4eb010d60f13fb",
"sha256": "6ed00a95815b4536c3331c3a5d4bf2ddc058c52c8d9ee51d99f446a3073357be"
},
"downloads": -1,
"filename": "causal_conv1d-1.2.2.post1.tar.gz",
"has_sig": false,
"md5_digest": "412d6af1f5ae76153d4eb010d60f13fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7170,
"upload_time": "2024-05-26T19:53:08",
"upload_time_iso_8601": "2024-05-26T19:53:08.735106Z",
"url": "https://files.pythonhosted.org/packages/51/e8/ad8c4be8207a3b46bf7161f2af9be8b95d8bfb7195779e1b9c411c48c1b4/causal_conv1d-1.2.2.post1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-26 19:53:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Dao-AILab",
"github_project": "causal-conv1d",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "causal-conv1d"
}