Fast, differentiable sorting and ranking in pure PyTorch without C++ or CUDA. This is a lightweight implementation of Fast Differentiable Sorting and Ranking (Blondel et al.) and inspired by torchsort. Unlike the torchsort, this version contains no C++ or CUDA extensions, making it easy to install and portable across platforms. While the original C++/CUDA implementation may have a performance edge for extremely large batch sizes, this pure PyTorch version is optimized to be efficient for standard deep learning workflows. Try it here:
Installation
pip install torchpsort
[!CAUTION] Do not use
torch.compilewith these functions. Because the implementation uses a sequential Python loop over the sequence length ($p$) to guarantee $O(Bp)$ memory efficiency,torch.compilewill cause a graph compilation explosion for large sequences.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 torchpsort-0.1.3.tar.gz.
File metadata
- Download URL: torchpsort-0.1.3.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa3346324f6c38b447ef6a7de4f9d09b527a8d57bf986a9af95611231422bd51
|
|
| MD5 |
cbf98643c264f8fbca5fab80d04070e2
|
|
| BLAKE2b-256 |
c39e6087dae835203e67f4b373c0d77ba0430c76c7990a4c0e318e3695b2f0a3
|
File details
Details for the file torchpsort-0.1.3-py3-none-any.whl.
File metadata
- Download URL: torchpsort-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c413e28b3eb1891d36906adb459e27d6ff3180bdd83f3ee7f7769b88bb646e6
|
|
| MD5 |
4c1b9a9804cd1b5b7cfb36f2fdc2b90f
|
|
| BLAKE2b-256 |
8d0b2838e5de74dbdbac93008db3feaa419c7c2f2321dcd0c7e94daaab3af280
|