Skip to main content

Causal depthwise conv1d in CUDA, with a PyTorch interface

Project description

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]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

causal_conv1d-1.1.0.tar.gz (6.6 kB view details)

Uploaded Source

File details

Details for the file causal_conv1d-1.1.0.tar.gz.

File metadata

  • Download URL: causal_conv1d-1.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for causal_conv1d-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bdbbfb61457291efe907a1cb2db5fe46a6c3ee210b3ca0fb57ba21b8daf64f04
MD5 6635dfa4dfe72e35ff6d7365754755a0
BLAKE2b-256 9e8a71ca8ab22bba0d630a6a464285893ebde89de6a8df169ea636717b47f786

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page