{"id":15601039,"url":"https://github.com/lucidrains/aoa-pytorch","last_synced_at":"2025-12-13T16:04:41.807Z","repository":{"id":57410775,"uuid":"310913238","full_name":"lucidrains/AoA-pytorch","owner":"lucidrains","description":"A Pytorch implementation of Attention on Attention module (both self and guided variants), for Visual Question Answering","archived":false,"fork":false,"pushed_at":"2020-11-08T00:17:30.000Z","size":40,"stargazers_count":41,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-08T05:12:19.234Z","etag":null,"topics":["attention","attention-mechanism","captioning","visual-question-answering","vqa"],"latest_commit_sha":null,"homepage":"","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/lucidrains.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":"2020-11-07T19:04:22.000Z","updated_at":"2025-02-16T10:05:49.000Z","dependencies_parsed_at":"2022-08-27T22:02:48.499Z","dependency_job_id":null,"html_url":"https://github.com/lucidrains/AoA-pytorch","commit_stats":null,"previous_names":["lucidrains/saoa-pytorch"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FAoA-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FAoA-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FAoA-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidrains%2FAoA-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidrains","download_url":"https://codeload.github.com/lucidrains/AoA-pytorch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242667466,"owners_count":20166296,"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":["attention","attention-mechanism","captioning","visual-question-answering","vqa"],"created_at":"2024-10-03T02:12:48.633Z","updated_at":"2025-12-13T16:04:41.134Z","avatar_url":"https://github.com/lucidrains.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./saoa.png\"\u003e\u003c/img\u003e\n\n## Attention on Attention - Pytorch\n\nA Pytorch implementation of the Attention on Attention module, from the paper \u003ca href=\"https://arxiv.org/abs/2011.02164v1\"\u003eAn Improved Attention for Visual Question Answering\u003c/a\u003e. The repository will include both the Self and Guided (cross-attention) variants.\n\n## Install\n\n```bash\n$ pip install aoa-pytorch\n```\n\n## Usage\n\nSelf Attention on Attention\n\n```python\nimport torch\nfrom aoa_pytorch import AoA\n\nattn = AoA(\n    dim = 512,\n    heads = 8\n)\n\nx = torch.randn(1, 1024, 512)\nattn(x) + x # (1, 1024, 512)\n```\n\nGuided Attention on Attention\n\n```python\n```python\nimport torch\nfrom aoa_pytorch import AoA\n\nattn = AoA(\n    dim = 512,\n    heads = 8\n)\n\nx = torch.randn(1, 1024, 512)\ncontext = torch.randn(1, 1024, 512)\n\nattn(x, context = context) + x # (1, 1024, 512)\n```\n\n## Citations\n\n```bibtex\n@misc{rahman2020improved,\n    title   = {An Improved Attention for Visual Question Answering}, \n    author  = {Tanzila Rahman and Shih-Han Chou and Leonid Sigal and Giuseppe Carenini},\n    year    = {2020},\n    eprint  = {2011.02164},\n    archivePrefix = {arXiv},\n    primaryClass = {cs.CV}\n}\n```\n\n```bibtex\n@misc{huang2019attention,\n    title   = {Attention on Attention for Image Captioning}, \n    author  = {Lun Huang and Wenmin Wang and Jie Chen and Xiao-Yong Wei},\n    year    = {2019},\n    eprint  = {1908.06954},\n    archivePrefix = {arXiv},\n    primaryClass = {cs.CV}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Faoa-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidrains%2Faoa-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidrains%2Faoa-pytorch/lists"}