{"id":17475398,"url":"https://github.com/stared/pytorch-named-dims","last_synced_at":"2026-05-16T17:02:20.160Z","repository":{"id":141629717,"uuid":"266759614","full_name":"stared/pytorch-named-dims","owner":"stared","description":"PyTorch tensor dimension names for all nn.Modules","archived":false,"fork":false,"pushed_at":"2020-09-04T13:44:48.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T13:08:43.975Z","etag":null,"topics":["dimensions","named-tensor","pytorch","tensor"],"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/stared.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":"2020-05-25T11:17:57.000Z","updated_at":"2020-09-04T13:44:51.000Z","dependencies_parsed_at":"2023-03-13T10:31:08.389Z","dependency_job_id":null,"html_url":"https://github.com/stared/pytorch-named-dims","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stared/pytorch-named-dims","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stared%2Fpytorch-named-dims","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stared%2Fpytorch-named-dims/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stared%2Fpytorch-named-dims/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stared%2Fpytorch-named-dims/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stared","download_url":"https://codeload.github.com/stared/pytorch-named-dims/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stared%2Fpytorch-named-dims/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33111497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dimensions","named-tensor","pytorch","tensor"],"created_at":"2024-10-18T18:45:54.689Z","updated_at":"2026-05-16T17:02:20.133Z","avatar_url":"https://github.com/stared.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytorch-named-dims\n\nPyTorch tensor dimension names for all `nn.Modules`.\n\nExtends [PyTorch Named Tensors](https://pytorch.org/docs/stable/named_tensor.html) ([new in PyTorch 1.4.0](https://github.com/pytorch/pytorch/releases/tag/v1.4.0), still experimental as of PyTorch 1.5.0). It works in Python 3.6+.\n\nInspired by:\n\n* [Quantum Tensors JS](https://github.com/Quantum-Game/quantum-tensors) by Piotr Migdał\n* [Tensor Considered Harmful](http://nlp.seas.harvard.edu/NamedTensor) by Alexander Rush\n\n## Installation\n\nNot yet on PyPI. Install:\n\n```bash\npip install git+git://github.com/stared/pytorch-named-dims.git\n```\n\n## Example\n\n```python\nimport torch\nfrom torch import nn\nfrom pytorch_named_dims import nm\n\nconvs = nn.Sequential(\n    nm.Conv2d(3, 5, kernel_size=3, padding=1),\n    nn.ReLU(),  # preserves dims on its own\n    nm.MaxPool2d(2, 2),\n    nm.Conv2d(5, 2, kernel_size=3, padding=1)\n)\n\nx_input_1 = torch.rand((4, 3, 2, 2), names=('N', 'C', 'H', 'W'))  # good\nx_input_2 = torch.rand((4, 3, 2, 2), names=('N', 'C', 'W', 'H'))  # bad\n\nconvs(x_input_1)  # returns ('N', 'C', 'H', 'W')\nconvs(x_input_2)  # raises:\n# Layer Conv2d requires dimensions ['N', 'C', 'H', 'W'] but got ('N', 'C', 'W', 'H') instead.\n```\n\n* TODO: Colab\n\n## Funding\n\nProject is supported by [Program Operacyjny Inteligentny Rozwój grant for ECC Games for GearShift project](https://mapadotacji.gov.pl/projekty/874596/?lang=en).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstared%2Fpytorch-named-dims","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstared%2Fpytorch-named-dims","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstared%2Fpytorch-named-dims/lists"}