# Sparse Filter Convolution
Sparse Filter Convolution is a Python package that provides a PyTorch function to perform fast convolutions with sparse global filters. The package includes a CUDA-optimized implementation of the `sparse_unfold` function, which is used internally by the `sparse_filter_convolution` function to efficiently process the input data.
## Functionality
The main function provided by this package is `sparse_filter_convolution(signal, filter, k)`, which takes the following input arguments:
- `signal`: A 3D PyTorch tensor of shape `(batch_size, dim, seq_len)`, representing a batch of input signals.
- `filter`: A 2D PyTorch tensor of shape `(dim, seq_len)`, representing a global filter that is applied to the input signals.
- `k`: An integer, representing the number of top elements to be considered from the filter.
The function returns a 3D PyTorch tensor of shape `(batch_size, dim, seq_len)`, which is the result of applying the sparse filter convolution to the input signals.
In addition to the `sparse_filter_convolution` function, this package also provides a lower-level CUDA-optimized function `sparse_unfold(padded_signal, top_k_indices, n)`, which can be used independently if desired. This function takes a padded signal, the top k indices of the filter, and the length of the signal as input arguments, and returns a sparse unfolded signal as a 4D PyTorch tensor.
## Usage
To use the `sparse_filter_convolution` function in your code, simply import it from the `sparse_filter_convolution` package:
```python
from sparse_filter_convolution import sparse_filter_convolution
Raw data
{
"_id": null,
"home_page": "https://github.com/tobiaskatsch/sparse_filter_convolution.git",
"name": "sparse-filter-convolution",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Your Name",
"author_email": "tobias.katsch42@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3b/10/fbc89cdfda57b8c91a8f664688615da8ff61b037254aaad6005addd61b36/sparse_filter_convolution-0.1.0.tar.gz",
"platform": null,
"description": "# Sparse Filter Convolution\r\n\r\nSparse Filter Convolution is a Python package that provides a PyTorch function to perform fast convolutions with sparse global filters. The package includes a CUDA-optimized implementation of the `sparse_unfold` function, which is used internally by the `sparse_filter_convolution` function to efficiently process the input data.\r\n\r\n## Functionality\r\n\r\nThe main function provided by this package is `sparse_filter_convolution(signal, filter, k)`, which takes the following input arguments:\r\n\r\n- `signal`: A 3D PyTorch tensor of shape `(batch_size, dim, seq_len)`, representing a batch of input signals.\r\n- `filter`: A 2D PyTorch tensor of shape `(dim, seq_len)`, representing a global filter that is applied to the input signals.\r\n- `k`: An integer, representing the number of top elements to be considered from the filter.\r\n\r\nThe function returns a 3D PyTorch tensor of shape `(batch_size, dim, seq_len)`, which is the result of applying the sparse filter convolution to the input signals.\r\n\r\nIn addition to the `sparse_filter_convolution` function, this package also provides a lower-level CUDA-optimized function `sparse_unfold(padded_signal, top_k_indices, n)`, which can be used independently if desired. This function takes a padded signal, the top k indices of the filter, and the length of the signal as input arguments, and returns a sparse unfolded signal as a 4D PyTorch tensor.\r\n\r\n## Usage\r\n\r\nTo use the `sparse_filter_convolution` function in your code, simply import it from the `sparse_filter_convolution` package:\r\n\r\n```python\r\nfrom sparse_filter_convolution import sparse_filter_convolution\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A CUDA extension for PyTorch to perform sparse filter convolution",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/tobiaskatsch/sparse_filter_convolution.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3b10fbc89cdfda57b8c91a8f664688615da8ff61b037254aaad6005addd61b36",
"md5": "675dd69e034a9307b3db5cc499945acb",
"sha256": "c30d5a76d3c78145454571c408d4172e26ddcf9c9aef240e588f5c96cac1c23f"
},
"downloads": -1,
"filename": "sparse_filter_convolution-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "675dd69e034a9307b3db5cc499945acb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3472,
"upload_time": "2023-05-06T16:54:53",
"upload_time_iso_8601": "2023-05-06T16:54:53.412741Z",
"url": "https://files.pythonhosted.org/packages/3b/10/fbc89cdfda57b8c91a8f664688615da8ff61b037254aaad6005addd61b36/sparse_filter_convolution-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-06 16:54:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tobiaskatsch",
"github_project": "sparse_filter_convolution",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "sparse-filter-convolution"
}