{"id":15698289,"url":"https://github.com/rusty1s/pytorch_bincount","last_synced_at":"2025-10-31T08:07:41.164Z","repository":{"id":57476469,"uuid":"136134681","full_name":"rusty1s/pytorch_bincount","owner":"rusty1s","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-03T09:05:42.000Z","size":13,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-09T01:14:20.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/rusty1s.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}},"created_at":"2018-06-05T07:04:38.000Z","updated_at":"2023-08-17T10:59:43.000Z","dependencies_parsed_at":"2022-09-12T14:34:21.399Z","dependency_job_id":null,"html_url":"https://github.com/rusty1s/pytorch_bincount","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Fpytorch_bincount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Fpytorch_bincount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Fpytorch_bincount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusty1s%2Fpytorch_bincount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusty1s","download_url":"https://codeload.github.com/rusty1s/pytorch_bincount/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171272,"owners_count":21865297,"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":[],"created_at":"2024-10-03T19:25:07.051Z","updated_at":"2025-10-31T08:07:41.054Z","avatar_url":"https://github.com/rusty1s.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[pypi-image]: https://badge.fury.io/py/torch-bincount.svg\n[pypi-url]: https://pypi.python.org/pypi/torch-bincount\n[build-image]: https://travis-ci.org/rusty1s/pytorch_bincount.svg?branch=master\n[build-url]: https://travis-ci.org/rusty1s/pytorch_bincount\n[coverage-image]: https://codecov.io/gh/rusty1s/pytorch_bincount/branch/master/graph/badge.svg\n[coverage-url]: https://codecov.io/github/rusty1s/pytorch_bincount?branch=master\n\n# PyTorch BinCount\n\n[![PyPI Version][pypi-image]][pypi-url]\n[![Build Status][build-image]][build-url]\n[![Code Coverage][coverage-image]][coverage-url]\n\n--------------------------------------------------------------------------------\n\n**PyTorch 0.4.1 now supports [`bincount`](https://pytorch.org/docs/stable/torch.html#torch.bincount) both for CPU and GPU.\nTherefore, this package is no longer needed and will not be updated.**\n\n--------------------------------------------------------------------------------\n\nThis package consists of a small extension library of a highly optimized `bincount` operation for the use in [PyTorch](http://pytorch.org/), which is missing in the main package.\nThe operation works on varying data types and is implemented both for CPU and GPU.\n\n## Installation\n\nEnsure that at least PyTorch 0.4.1 is installed and verify that `cuda/bin` and `cuda/include` are in your `$PATH` and `$CPATH` respectively, *e.g.*:\n\n```\n$ python -c \"import torch; print(torch.__version__)\"\n\u003e\u003e\u003e 0.4.1\n\n$ echo $PATH\n\u003e\u003e\u003e /usr/local/cuda/bin:...\n\n$ echo $CPATH\n\u003e\u003e\u003e /usr/local/cuda/include:...\n```\n\nThen run:\n\n```\npip install torch-bincount\n```\n\nIf you are running into any installation problems, please create an [issue](https://github.com/rusty1s/pytorch_bincount/issues).\nBe sure to import `torch` first before using this package to resolve symbols the dynamic linker must see.\n\n## Usage\n\n```\ntorch_bincount.bincount(src, size=None) -\u003e LongTensor\n```\n\nCounts the number of occurrences of each value in a non-negative tensor.\n\n### Parameters\n\n* **src** *(Tensor)* - The input tensor.\n* **size** *(int, optional)* - The maximum number of bins for the output array. (default: `None`)\n\n### Returns\n\n* **out** *(LongTensor)* - The result of binning the input tensor.\n\n### Example\n\n```py\nimport torch\nfrom torch_bincount import bincount\n\nsrc = torch.tensor([2, 1, 1, 2, 4, 4, 2])\nout = bincount(src)\n```\n\n```\nprint(out)\ntensor([ 0,  2,  3,  0,  2])\n```\n\n## Running tests\n\n```\npython setup.py test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty1s%2Fpytorch_bincount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusty1s%2Fpytorch_bincount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusty1s%2Fpytorch_bincount/lists"}