PyTorch extension package for Bessel functions with arbitrary real order and complex inputs
Project description
About
PyTorch extension package for modified Bessel functions of the second kind with complex inputs
Install
Currently only supports Linux (with CUDA 12.4) or MacOS (Apple silicon, cpu only) with python >= 3.9, <= 3.12.
pip install torch-bessel
Example
import torch_bessel
real, imag = torch.randn(2, 5, device="cuda")
z = torch.complex(real.abs(), imag) # correctness for inputs in the left-half complex plane is not gauranteed.
torch_bessel.ops.modified_bessel_k0(z)
Implemented functions
modified_bessel_k0: Same astorch.special.modified_bessel_k0, but also handles backpropagation and complex inputs on cpu and cuda. Correctness is guaranteed on the right-half complex plane for double types, and almost guaranteed for float types, though it appears there are a very small handful of inputs which result in NaNs which needs to be fixed. On cuda,torch.chalfinputs are also supported, though the underlying cuda kernel just upcastschalftocfloat(note that this uses no extra GPU memory, as opposed to manually casting torch.chalf to torch.cfloat before callingmodified_bessel_k0which doubles the GPU memory used). On the left-half complex plane, function output appears mostly correct, but with small numerical errors for certain inputs. On the negative real line, output is NaN.modified_bessel_k1: Same astorch.special.modified_bessel_k1, but also handles complex inputs on cpu and cuda. Backpropagation not implemented, but this can be easily manually implemented yourself by writing a torch.autograd.Function using the recurrence properties of bessel functions. Same caveats asmodified_bessel_k0apply.
WIP
modified_bessel_kv: Analogue ofscipy.special.kv.
Benchmarks
Benchmarking performed with the asv package. Results can be viewed at https://hchau630.github.io/torch-bessel.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_bessel-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 33.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a3bbd41fe75453738efcd889544c98284a8931840a8264d12868dc5da6d922a
|
|
| MD5 |
7718e77feab3df6901b467509a681eab
|
|
| BLAKE2b-256 |
4c3ab2f146490fc67aba7b827c8b8f168b676c98170c5c43994ea788a52f1b57
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
0a3bbd41fe75453738efcd889544c98284a8931840a8264d12868dc5da6d922a - Sigstore transparency entry: 245765922
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 82.4 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ca5f04d8483a97a923c3733ec3e1a12a9b54dc6542c77e95961d1a76e2a7264
|
|
| MD5 |
e612bc3662d2928bb3c58dc04646fd9e
|
|
| BLAKE2b-256 |
a2ace5712b1940da2f927a665d07b0fe1215fa3146fdffc267b22aa4b173f9ad
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
5ca5f04d8483a97a923c3733ec3e1a12a9b54dc6542c77e95961d1a76e2a7264 - Sigstore transparency entry: 245765924
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 33.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53a99bb2d89f7ba3eaef67454d3b89af2c277beac853fa67b95f8ef1d01b0fed
|
|
| MD5 |
f7306e0fa80ba743d7a3a9c502f6f14c
|
|
| BLAKE2b-256 |
890df643324b6c2c4a6b8d516233d2917e05040a852094a2764bd9efa5867e8e
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
53a99bb2d89f7ba3eaef67454d3b89af2c277beac853fa67b95f8ef1d01b0fed - Sigstore transparency entry: 245765916
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 83.6 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aea122965d0593674526cf55075a0f2871cabf447449395a150a2adf4ef95d76
|
|
| MD5 |
a21dbd4d8860c2060de53586734942eb
|
|
| BLAKE2b-256 |
b37b50807178512645cead688b19bb4451a5662a6d2af6455f0fe8a31ea1acdd
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp311-cp311-macosx_11_0_arm64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
aea122965d0593674526cf55075a0f2871cabf447449395a150a2adf4ef95d76 - Sigstore transparency entry: 245765926
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 33.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
689399eb1bf10c104f2b76ea1fc519bacb5d2056975d1af416506587f41b747d
|
|
| MD5 |
94a2e16f49f2ff85c2894586efae8296
|
|
| BLAKE2b-256 |
4398f512c64d1e50d0dfeeb7350aa08999f1b29e53d7547a0b79262e1fa074eb
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
689399eb1bf10c104f2b76ea1fc519bacb5d2056975d1af416506587f41b747d - Sigstore transparency entry: 245765909
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 82.0 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77e003881a623b0e72c70d2c8e5b22fcd43722d404892aeda4ee9594ba707029
|
|
| MD5 |
775cabd6c4f9ec7d54066d1b67881ab1
|
|
| BLAKE2b-256 |
0f7a0724e0dc95c1c09b12bb48f3b54f2c22413306157c5d38812866793a14ad
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
77e003881a623b0e72c70d2c8e5b22fcd43722d404892aeda4ee9594ba707029 - Sigstore transparency entry: 245765913
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 33.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c45693e3a7c707c78c8d9540962c8f26b7fff1d105a26c3995aeac0fa88a83f3
|
|
| MD5 |
4b1c28dc2bac5c6e0fb659899d1edf20
|
|
| BLAKE2b-256 |
86037cdef0947829151ea26415ba22cea09551a504b8a167412757cc709b3675
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
c45693e3a7c707c78c8d9540962c8f26b7fff1d105a26c3995aeac0fa88a83f3 - Sigstore transparency entry: 245765917
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file torch_bessel-0.0.7-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: torch_bessel-0.0.7-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 82.2 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c4963a10af4f0692bd292af6bcd35fa0641c6352da8306a500c137414946b6
|
|
| MD5 |
4ad07abeee45f296bf379ec0685adecd
|
|
| BLAKE2b-256 |
5bd0cc68bfb45946c2b3e4e5fd7728ee6a041ff90491efdde42d0ae8a789c23b
|
Provenance
The following attestation bundles were made for torch_bessel-0.0.7-cp39-cp39-macosx_11_0_arm64.whl:
Publisher:
build_and_deploy.yml on hchau630/torch-bessel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_bessel-0.0.7-cp39-cp39-macosx_11_0_arm64.whl -
Subject digest:
d7c4963a10af4f0692bd292af6bcd35fa0641c6352da8306a500c137414946b6 - Sigstore transparency entry: 245765911
- Sigstore integration time:
-
Permalink:
hchau630/torch-bessel@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/hchau630
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_deploy.yml@9e68edbcf326eb8d6bc54ef9f3aa63611443eaa7 -
Trigger Event:
release
-
Statement type: