SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2201.00520 · CVPR · 2022

Vision Transformer with Deformable Attention

Gao Huang, Shiji Song, Xuran Pan, Erran Li, Li, Zhuofan Xia

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 4 failures of our instrument; 2 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2201.00520.json · badge: /api/ran/2201.00520.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ChristophReich1996/Swin-Transformer-V2 community
Papers with Code archive
6 ran · 2 no recorded run
LeapLabTHU/DAT community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
DAttentionBaseline Ran
ran on a synthesized input · constructed an object; no result was computed
LeapLabTHU/DAT/models/dat_blocks.py
code served (permissive licence) · get_code("7cba8d74ab462cab")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, DAttentionBaseline: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

ARGS = {
    'q_size': (4, 3),
    'kv_size': (4, 3),
    'n_heads': 2,
    'n_head_channels': 2,
    'n_groups': 1,
    'attn_drop': 0.1,
    'proj_drop': 0.1,
    'stride': 1,
    'offset_range_factor': 2.0,
    'use_pe': True,
    'dwc_pe': False,
    'no_off': False,
    'fixed_pe': False,
    'ksize': 3,
    'log_cpb': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, numpy, timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DAttentionBaseline — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DAttentionBaseline output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FeedForward Ran
ran on a synthesized input · constructed an object; no result was computed
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("2aa71e543f03992a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, FeedForward: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_features": 8,
    "hidden_features": 16,
    "out_features": 4,
    "dropout": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FeedForward — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FeedForward output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LayerNormProxy Ran
ran on a synthesized input · constructed an object; no result was computed
LeapLabTHU/DAT/models/dat_blocks.py
code served (permissive licence) · get_code("5ebf85fee0f0738f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LayerNormProxy: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import einops

torch.manual_seed(0)

ARGS = {
    'dim': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LayerNormProxy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LayerNormProxy output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
WindowMultiHeadAttention Ran
ran on a synthesized input · constructed an object; no result was computed
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("5716ef7256430436")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, WindowMultiHeadAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'in_features': 64,
    'window_size': 4,
    'number_of_heads': 4,
    'dropout_attention': 0.1,
    'dropout_projection': 0.1,
    'meta_network_hidden_features': 256,
    'sequential_self_attention': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type WindowMultiHeadAttention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a WindowMultiHeadAttention output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
bchw_to_bhwc Ran
ran; our contract draft was wrong, not the code
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("f76dfdc07001b5e3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 5, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small tensor in BCHW format (batch, channels, height, width)
# Using distinct dimensions: batch=2, channels=3, height=4, width=5
input_tensor = torch.randn(2, 3, 4, 5)

ARGS = {
    "input": input_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 5, 3) — shape (2, 4, 5, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
bhwc_to_bchw Ran
ran; our contract draft was wrong, not the code
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("8c3d7c2fece98766")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 5, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a tensor in BHWC format (batch, height, width, channels)
# Using distinct sizes: batch=2, height=4, width=3, channels=5
input_tensor = torch.randn(2, 4, 3, 5)

ARGS = {
    "input": input_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 5, 4, 3) — shape (2, 5, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
fold Ran
ran; our contract draft was wrong, not the code
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("ae92018684b30199")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 8, 12) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function expects:
# - input: tensor of shape [batch_size * num_windows, channels, window_size, window_size]
#   where num_windows = (height // window_size) * (width // window_size)
# - window_size: int, the size of each window
# - height: int, height of original feature map
# - width: int, width of original feature map

# Let's use small values:
batch_size = 2
window_size = 4
height = 8
width = 12
channels = 3

# Number of windows per batch item
num_windows_h = height // window_size  # 2
num_windows_w = width // window_size   # 3
num_windows_per_batch = num_windows_h * num_windows_w  # 6

# Total first dimension: batch_size * num_windows_per_batch = 2 * 6 = 12
input_tensor = torch.randn(batch_size * num_windows_per_batch, channels, window_size, window_size)

ARGS = {
    "input": input_tensor,
    "window_size": window_size,
    "height": height,
    "width": width,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 8, 12) — shape (2, 3, 8, 12) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
unfold Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("31576ed450a2bd34")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (8, 3, 2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small input tensor
# Shape: [batch_size, channels, height, width]
# Using distinct sizes: batch=2, channels=3, height=4, width=4
input_tensor = torch.randn(2, 3, 4, 4)

# Window size must divide evenly into height and width for non-overlapping unfold
window_size = 2

ARGS = {
    "input": input_tensor,
    "window_size": window_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (8, 3, 2, 2) — shape (8, 3, 2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DeformableSwinTransformerBlock Not yet run
unverified (harvested, no recorded run)
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("6fba747e5af83c5f")
How it ran

no invocation recorded.

SwinTransformerBlock Not yet run
unverified (harvested, no recorded run)
ChristophReich1996/Swin-Transformer-V2/swin_transformer_v2/model_parts.py
code served (permissive licence) · get_code("3b8f635fca41be47")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 9 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
LayerNormProxy
brick of this paper's assembly: helper
1 other paper
1 later
2208.00306 (2022-08)
Doubly Deformable Aggregation of Covariance Matrices for Few-shot Segmentation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Transformers have recently shown superior performances on various vision tasks. The large, sometimes even global, receptive field endows Transformer models with higher representation power over their CNN counterparts. Nevertheless, simply enlarging receptive field also gives rise to several concerns. On the one hand, using dense attention e.g., in ViT, leads to excessive memory and computational cost, and features can be influenced by irrelevant parts which are beyond the region of interests. On the other hand, the sparse attention adopted in PVT or Swin Transformer is data agnostic and may limit the ability to model long range relations. To mitigate these issues, we propose a novel deformable self-attention module, where the positions of key and value pairs in self-attention are selected in a data-dependent way. This flexible scheme enables the self-attention module to focus on relevant regions and capture more informative features. On this basis, we present Deformable Attention Transformer, a general backbone model with deformable attention for both image classification and dense prediction tasks. Extensive experiments show that our models achieve consistently improved results on comprehensive benchmarks. Code is available at https://github.com/LeapLabTHU/DAT. * Equal contribution. † Work done outside of Amazon. ‡ Corresponding author. (a) ViT (b) Swin Transformer (c) DCN (d) DAT (ours) Query Receptive Field Deformed Point

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2201.00520")
get_code_for_paper("2201.00520")
have("2201.00520")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2201.00520.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2201.00520.svg)](https://syntology.ai/paper/2201.00520)

Connect an agent — have() is free.