All models

swin_s3_tiny_224

Swin Transformer: hierarchical vision transformer with self-attention in shifted local windows.

Image classification · 642 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (20 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
Swin
Parameters
28.3M
Operations
642
Framework
PyTorch
Recurrent
No
Published
2021
Cited by
60 (as of 18 November 2026)
Authors
Minghao Chen, Kan Wu, Bolin Ni and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m10421
Graph hash
5072f599a788deb313a578ccda7a0b59cd29e92dc061024f83e50af3d80c3a4e
Skeleton hash
b6b77f02be6978615177e88ed4f488164e78bde6175698a33914c7ab93c2e68a
Architecture hash
8c96820eca7b37997d9d4b608a6c14e002ec63c8365c525baec5c76dac03f9a6
Diagram SHA-256
183f4cacea7e29ac5d29ac0267b0376462c6677dd7f3cfebf456ac583021a17c
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

timm.create_model('swin_s3_tiny_224', pretrained=False)

What it is

About this model's family

Swin Transformer is a hierarchical vision transformer that serves as a general-purpose backbone for computer vision. Moving the Transformer from language to vision runs into large variations in the scale of visual entities and the high resolution of pixels compared to words. Its answer is shifted windows: self-attention is limited to non-overlapping local windows for efficiency, while shifting the windows between layers allows cross-window connection. This gives linear computational complexity in image size and the flexibility to model at various scales.

The network first splits the image into non-overlapping 4x4 patches, so each token starts as a 48-dimensional vector of raw pixel values that a linear embedding projects to dimension C. Patch merging layers then concatenate each 2x2 group of neighboring patches and apply a linear layer to the 4C-dimensional result, building the hierarchy stage by stage. The shifted partition is computed by a cyclic shift that keeps the number of batched windows the same as regular window partitioning. The learnt relative position bias from pre-training can also initialize a model for fine-tuning at a different window size through bi-cubic interpolation.

Swin-B is sized like ViT-B/DeiT-B, and Swin-T, Swin-S and Swin-L are about 0.25x, 0.5x and 2x its model size and compute. The window size is set to M = 7 by default. Swin-T uses C = 96 with layer numbers {2, 2, 6, 2}, and Swin-S keeps C = 96 with {2, 2, 18, 2}. Swin-B raises C to 128 and Swin-L to 192, both with layer numbers {2, 2, 18, 2}.

The timm members use code and weights from Microsoft's Swin-Transformer repository. The three swin_s3 members instead load S3 (AutoFormerV2) Swin weights from Microsoft's Cream repository. S3 models come from neural architecture search that searches not only the architecture but also the search space, gradually evolving the search dimensions guided by an E-T Error computed with a weight-sharing supernet. In Transformers, Swin can pad inputs to any height and width divisible by 32 and can be used as a backbone. The paper reports 87.3 top-1 on ImageNet-1K, 58.7 box AP and 51.1 mask AP on COCO test-dev, and 53.5 mIoU on ADE20K val.

Key idea. Self-attention inside shifted local windows, giving a hierarchical vision transformer with linear complexity in image size that works as a general-purpose backbone.

  • swin transformer
  • swin
  • swin-t
  • swin-s
  • swin-b
  • swin-l
  • shifted windows
  • s3
  • autoformerv2
  • image classification
  • backbone
  • microsoft

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{chen2021searchingsearchspacevision,
      title={Searching the Search Space of Vision Transformer}, 
      author={Minghao Chen and Kan Wu and Bolin Ni and Houwen Peng and Bei Liu and Jianlong Fu and Hongyang Chao and Haibin Ling},
      year={2021},
      eprint={2111.14725},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2111.14725}, 
}