Skip to main content

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: Open In Colab

Installation

pip install torchpsort

[!NOTE] The streaming CPU implementation is intended to run in eager mode. Because it relies on a sequential Python loop over the sequence length (p) to achieve O(Bp) memory usage, torch.compile may introduce substantial compilation overhead for large sequences. The GPU chunked implementation, however, remains compatible with torch.compile.

Download files

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

Source Distribution

torchpsort-0.1.7.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchpsort-0.1.7-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file torchpsort-0.1.7.tar.gz.

File metadata

  • Download URL: torchpsort-0.1.7.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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

Hashes for torchpsort-0.1.7.tar.gz
Algorithm Hash digest
SHA256 42fb128a2b6234a9b543da268ab4ba482a4dacc4826e7d2063e78cc753762392
MD5 02278f0a2205fe0318fb36864f56536e
BLAKE2b-256 cecd8ccdd62c5ea6a6c1806705100075f18df130d24c31fe24a8ab4268a3f92b

See more details on using hashes here.

File details

Details for the file torchpsort-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: torchpsort-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","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

Hashes for torchpsort-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b2ea6eb4266513c53dc5d39f110b3e59eac53e0f079c67bdda337d8f4831b75c
MD5 1307568d3319fce596bd57167c408931
BLAKE2b-256 fdf06dc886f57087459a42327195e85a343b440f6eda2583de68d8946f765e9d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.8

2 files

This release

0.1.7 This release

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page