Skip to main content

This package implements an efficient parallel algorithm for the computation of discounted cumulative sums with differentiable bindings to PyTorch. The cumsum operation is frequently seen in data science domains concerned with time series, including Reinforcement Learning (RL).

The traditional sequential algorithm performs the computation of the output elements in a loop. For an input of size N, it requires O(N) operations and takes O(N) time steps to complete.

The proposed parallel algorithm requires a total of O(N log N) operations, but takes only O(log N) time, which is a considerable trade-off in many applications involving large inputs.

Features of the parallel algorithm:

  • Speed logarithmic in the input size
  • Better numerical precision than sequential algorithms

Features of the package:

  • CPU: sequential algorithm in C++
  • GPU: parallel algorithm in CUDA
  • Gradients computation for input and gamma
  • Batch support for input and gamma
  • Both left and right directions of summation supported
  • PyTorch bindings

Find more details and the most up-to-date information on the project webpage: https://www.github.com/toshas/torch-discounted-cumsum

Metadata

Release files for torch-discounted-cumsum 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-discounted-cumsum 1.1.0
File Size Uploaded Provenance
torch_discounted_cumsum-1.1.0.tar.gz 185.4 kB Without provenance Details

Release files / torch_discounted_cumsum-1.1.0.tar.gz

Download URL torch_discounted_cumsum-1.1.0.tar.gz
Size 185.4 kB
Tags Source
SHA-256 checksum
How to use checksums
34e6a7e10f416a7aa84e5fb4e00d6a84a0cfbb0a68bcf22a3434488360f0ea37
BLAKE2b-256 checksum
How to use checksums
f5af9e9afa05c919429c09289237134d7e053e0110363939c5acf077c30079dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

Security for torch-discounted-cumsum 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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