# epfml/attention-cnn

Source code for "On the Relationship between Self-Attention and Convolutional Layers"

Repository: https://github.com/epfml/attention-cnn
Canonical: https://ross.abutalabs.com/products/attention-cnn
Homepage: https://arxiv.org/pdf/1911.03584.pdf
Language: Python
License: Apache-2.0
License Family: permissive
Last push: 2023-01-10T10:00:25+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2626, "days_push": 1331, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1121, forks 129 (observed 2026-08-28T04:03:39.811698+00:00)

## What it is
Official PyTorch source code for the ICLR 2020 paper 'On the Relationship between Self-Attention and Convolutional Layers', which proves and empirically shows that multi-head self-attention layers can learn to perform convolution. It includes experiment scripts to reproduce all results from the paper.

## Use cases
- reproduce experiments from the self-attention vs convolution paper
- study how attention layers learn convolutional behavior
- compare multi-head self-attention with CNN layers on image tasks
- get a reference PyTorch implementation of attention-based vision models
- explore research on attention mechanisms in computer vision

## When to choose
- you want to reproduce or extend the paper's experiments
- you are researching the relationship between self-attention and convolution
- you need a reference implementation of multi-head self-attention for vision

## When to avoid
- you need a production-ready vision transformer library
- you want maintained, general-purpose deep learning tooling rather than research code
- you need a framework with broad model support and community maintenance

## Facets
- artifact type: learning-resource
- maturity: maintenance
- function: deep-learning, machine-learning, image-processing, benchmarking
- domain: deep-learning, computer-vision
- platform: python
- tags: self-attention, convolution, vision-transformer, iclr-2020, research-code, pytorch, reproducibility, research, linux, gpu

## Member repositories
- epfml/attention-cnn (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:39.811698+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:41:00.337272+00:00, confidence not recorded.
  - readme: https://github.com/epfml/attention-cnn (fetched 2026-08-28T04:03:39.811698+00:00, sha 64f93c0bf0c9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
