{"id":13737718,"url":"https://github.com/francois-rozet/torchist","last_synced_at":"2025-09-16T08:31:36.924Z","repository":{"id":57476521,"uuid":"340099525","full_name":"francois-rozet/torchist","owner":"francois-rozet","description":"NumPy-style histograms in PyTorch","archived":false,"fork":false,"pushed_at":"2024-04-03T14:48:11.000Z","size":30,"stargazers_count":52,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-30T21:41:44.534Z","etag":null,"topics":["histogram","numpy","pytorch"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/torchist","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/francois-rozet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-18T15:52:15.000Z","updated_at":"2024-12-20T03:04:38.000Z","dependencies_parsed_at":"2024-10-28T20:34:59.637Z","dependency_job_id":"0bcef8f7-c375-415d-9918-9ab48c09fbec","html_url":"https://github.com/francois-rozet/torchist","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francois-rozet%2Ftorchist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francois-rozet%2Ftorchist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francois-rozet%2Ftorchist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francois-rozet%2Ftorchist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/francois-rozet","download_url":"https://codeload.github.com/francois-rozet/torchist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233238156,"owners_count":18646055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["histogram","numpy","pytorch"],"created_at":"2024-08-03T03:01:58.318Z","updated_at":"2025-09-16T08:31:31.552Z","avatar_url":"https://github.com/francois-rozet.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# NumPy-style histograms in PyTorch\n\nThe `torchist` package implements NumPy's [`histogram`](https://numpy.org/doc/stable/reference/generated/numpy.histogram.html) and [`histogramdd`](https://numpy.org/doc/stable/reference/generated/numpy.histogramdd.html) functions in PyTorch with CUDA support. The package also features implementations of [`ravel_multi_index`](https://numpy.org/doc/stable/reference/generated/numpy.ravel_multi_index.html), [`unravel_index`](https://numpy.org/doc/stable/reference/generated/numpy.unravel_index.html) and some useful functionals like `entropy` or `kl_divergence`.\n\n## Installation\n\nThe `torchist` package is available on [PyPI](https://pypi.org/project/torchist), which means it is installable with `pip`.\n\n```\npip install torchist\n```\n\nAlternatively, if you need the latest features, you can install it from the repository.\n\n```\npip install git+https://github.com/francois-rozet/torchist\n```\n\n## Getting Started\n\n```python\nimport torch\nimport torchist\n\nx = torch.rand(100, 3).cuda()\n\nhist = torchist.histogramdd(x, bins=10, low=0.0, upp=1.0)\n\nprint(hist.shape)  # (10, 10, 10)\n```\n\n## Benchmark\n\nThe implementations of `torchist` are on par or faster than those of `numpy` on CPU and benefit greately from CUDA capabilities.\n\n```console\n$ python torchist/__init__.py\nCPU\n---\nnp.histogram : 1.2559 s\nnp.histogramdd : 20.7816 s\nnp.histogram (non-uniform) : 5.4878 s\nnp.histogramdd (non-uniform) : 17.3757 s\ntorchist.histogram : 1.3975 s\ntorchist.histogramdd : 9.6160 s\ntorchist.histogram (non-uniform) : 5.0883 s\ntorchist.histogramdd (non-uniform) : 17.2743 s\n\nCUDA\n----\ntorchist.histogram : 0.1363 s\ntorchist.histogramdd : 0.3754 s\ntorchist.histogram (non-uniform) : 0.1355 s\ntorchist.histogramdd (non-uniform) : 0.5137 s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancois-rozet%2Ftorchist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrancois-rozet%2Ftorchist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancois-rozet%2Ftorchist/lists"}