# xmu-xiaoma666/external-attention-pytorch architecture

> Architecture diagram of the GitHub repository xmu-xiaoma666/external-attention-pytorch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xmu-xiaoma666/external-attention-pytorch
- Repository: https://github.com/xmu-xiaoma666/external-attention-pytorch

## Overview

FightingCV is a PyTorch component library for reusable computer-vision building blocks, not an end-to-end training application. Its documented user workflow is to import a component, construct it with task-specific dimensions, pass tensors through it, and receive transformed tensors. The README groups the library into attention, backbone, MLP, convolution, and re-parameterization families; these nodes represent those substantial capability areas. Source evidence is limited, so internal links between library families are omitted rather than inferred.

Main entry points: [`model/attention/MobileViTv2Attention.py`](https://github.com/xmu-xiaoma666/external-attention-pytorch/blob/master/model/attention/MobileViTv2Attention.py) (MobileViTv2 attention), [`main.py`](https://github.com/xmu-xiaoma666/external-attention-pytorch/blob/master/main.py) (Example runner), [`model/attention`](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/attention) (Attention components), [`model/backbone`](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/backbone) (Vision backbones)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_attention["Attention"]
  node_attention_modules["Attention components"]
  node_mobilevitv2["MobileViTv2 attention"]
end

subgraph group_backbones["Backbones"]
  node_backbone_models["Vision backbones"]
end

subgraph group_mlp["MLP Blocks"]
  node_mlp_modules["MLP components"]
end

subgraph group_convolution["Convolution"]
  node_conv_modules["Convolution components"]
end

subgraph group_reparameterization["Re-parameterization"]
  node_rep_modules["Re-parameterized blocks"]
end

node_developer(("Library user"))
node_demo["Example runner<br/>[main.py]"]
node_tensor_output["Output tensor"]

node_developer -->|"imports and uses"| node_attention_modules
node_developer -->|"uses models"| node_backbone_models
node_developer -->|"uses blocks"| node_mlp_modules
node_developer -->|"uses modules"| node_conv_modules
node_developer -->|"uses blocks"| node_rep_modules
node_demo -->|"instantiates and calls"| node_mobilevitv2
node_mobilevitv2 -->|"returns"| node_tensor_output

click node_attention_modules "https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/attention"
click node_backbone_models "https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/backbone"
click node_mlp_modules "https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/mlp"
click node_conv_modules "https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/conv"
click node_rep_modules "https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/rep"
click node_demo "https://github.com/xmu-xiaoma666/external-attention-pytorch/blob/master/main.py"
click node_mobilevitv2 "https://github.com/xmu-xiaoma666/external-attention-pytorch/blob/master/model/attention/MobileViTv2Attention.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_attention_modules,node_mobilevitv2,node_developer toneBlue
class node_backbone_models toneAmber
class node_mlp_modules toneMint
class node_conv_modules toneRose
class node_rep_modules,node_tensor_output toneIndigo
class node_demo toneTeal
```

## Components

### Attention

- [Attention components](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/attention): `model/attention`
- [MobileViTv2 attention](https://github.com/xmu-xiaoma666/external-attention-pytorch/blob/master/model/attention/MobileViTv2Attention.py): `model/attention/MobileViTv2Attention.py`

### Backbones

- [Vision backbones](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/backbone): `model/backbone`

### MLP Blocks

- [MLP components](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/mlp): `model/mlp`

### Convolution

- [Convolution components](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/conv): `model/conv`

### Re-parameterization

- [Re-parameterized blocks](https://github.com/xmu-xiaoma666/external-attention-pytorch/tree/master/model/rep): `model/rep`

### Other components

- **Library user**
- [Example runner](https://github.com/xmu-xiaoma666/external-attention-pytorch/blob/master/main.py): `main.py`
- **Output tensor**

## Connections

- Library user → Attention components: imports and uses (evidence: `README.md`)
- Library user → Vision backbones: uses models (evidence: `README.md`)
- Library user → MLP components: uses blocks (evidence: `README.md`)
- Library user → Convolution components: uses modules (evidence: `README.md`)
- Library user → Re-parameterized blocks: uses blocks (evidence: `README.md`)
- Example runner → MobileViTv2 attention: instantiates and calls (evidence: `main.py`)
- MobileViTv2 attention → Output tensor: returns (evidence: `model/attention/MobileViTv2Attention.py`)
