SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.03650 · 2021

Shuffle Transformer: Rethinking Spatial Shuffle for Vision Transformer

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 7 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; 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/2106.03650.json · badge: /api/ran/2106.03650.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
mulinmeng/Shuffle-Transformer community (classifier label)
classifier basis not recorded on the link
10 ran · 2 no recorded run
FunctionStatusWhere it lives
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mulinmeng/Shuffle-Transformer/models/swin_transformer.py
code served (permissive licence) · get_code("144d10b49baeb8a6")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (8, 4, 4, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:38:58Z). 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 with shape (B, H, W, C)
# B=2 (batch), H=8 (height), W=8 (width), C=4 (channels)
# Using distinct sizes: 2, 8, 8, 4
x = torch.randn(2, 8, 8, 4)

# window_size must divide both H and W evenly
# H=8, W=8, so window_size=4 works (8 // 4 = 2)
window_size = 4

ARGS = {
    "x": x,
    "window_size": window_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, 4, 4, 4) — shape (8, 4, 4, 4) 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
auto_resume_helper Ran
ran; our contract draft was wrong, not the code
mulinmeng/Shuffle-Transformer/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("0c32459bef92ff8c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from leaplabthu/inline, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_optimizer Ran
ran; our contract draft was wrong, not the code
mulinmeng/Shuffle-Transformer/optimizer.py
pointer only (licence: MIT); the stored copy get_code serves, from CBalance/SSD, is pointer only (licence: NONE) · get_code("e35a4b2e4114b1a5")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from CBalance/SSD, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_scheduler Ran
ran; our contract draft was wrong, not the code
mulinmeng/Shuffle-Transformer/lr_scheduler.py
pointer only (licence: MIT); the stored copy get_code serves, from ghrua/seqpe, is pointer only (licence: NONE) · get_code("c02cc4e0b5720211")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ghrua/seqpe, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_keywords_in_name Ran
ran, violated the contract we drafted
mulinmeng/Shuffle-Transformer/optimizer.py
pointer only (licence: MIT); the stored copy get_code serves, from leaplabthu/inline, is pointer only (licence: NONE) · get_code("b0a5beb34716d5a6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from leaplabthu/inline, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

create_logger Ran
ran; our contract draft was wrong, not the code
mulinmeng/Shuffle-Transformer/logger.py
pointer only (licence: MIT); the stored copy get_code serves, from ghrua/seqpe, is pointer only (licence: NONE) · get_code("80450600f7f09b0a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ghrua/seqpe, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_grad_norm Ran
ran, honoured the contract we drafted
mulinmeng/Shuffle-Transformer/utils.py
code served (permissive licence) · get_code("eec1e7cba51d5e8e")
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) and returned float, ndim 0, dtype family float, shape () 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
import torch.nn as nn

torch.manual_seed(0)

# Create a simple model with parameters that have gradients
model = nn.Linear(4, 3)

# Forward pass to create some gradients
x = torch.randn(2, 4)
y = model(x)
loss = y.sum()
loss.backward()

# Now model.parameters() have gradients attached
parameters = list(model.parameters())

ARGS = {
    "parameters": parameters,
    "norm_type": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () 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
load_checkpoint Ran
ran on a synthesized input
mulinmeng/Shuffle-Transformer/utils.py
code served (permissive licence) · get_code("640408a0715e42c2")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import torch.nn as nn
from unittest.mock import Mock, MagicMock
import logging

torch.manual_seed(0)

# Create a minimal model
class TinyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = TinyModel()

# Create optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Create lr_scheduler
lr_scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=10)

# Create a mock config with required attributes
class Config:
    def __init__(self):
        self.MODEL = Mock()
        self.MODEL.RESUME = '/tmp/checkpoint.pth'
        self.EVAL_MODE = True
        self.AMP_OPT_LEVEL = 'O0'
        self.TRAIN = Mock()
        self.TRAIN.START_EPOCH = 0
        self._frozen = False
    
    def defrost(self):
        self._frozen = False
    
    def freeze(self):
        self._frozen = True

config = Config()

# Create a mock logger
logger = Mock(spec=logging.Logger)
logger.info = MagicMock()

# Create a checkpoint file (mock by using torch.save)
checkpoint_data = {
    'model': model.state_dict(),
    'optimizer': optimizer.state_dict(),
    'lr_scheduler': lr_scheduler.state_dict(),
    'epoch': 5,
    'max_accuracy': 0.95,
    'config': config,
    'amp': {}
}

# Since we can't do real file I/O, we'll mock torch.load
original_torch_load = torch.load
def mock_torch_load(path, map_location=None):
    return checkpoint_data

torch.load = mock_torch_load

ARGS = {
    'config': config,
    'model': model,
    'optimizer': optimizer,
    'lr_scheduler': lr_scheduler,
    'logger': logger
}
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 float, ndim 0, dtype family float, shape () — shape () 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
set_weight_decay Ran
ran; our contract draft was wrong, not the code
mulinmeng/Shuffle-Transformer/optimizer.py
pointer only (licence: MIT); the stored copy get_code serves, from ztx-100/efficient_vit_with_dw, is pointer only (licence: NONE) · get_code("b33222a09fc93bec")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ztx-100/efficient_vit_with_dw, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

window_reverse Ran
ran; our contract draft was wrong, not the code
mulinmeng/Shuffle-Transformer/models/swin_transformer.py
code served (permissive licence) · get_code("61bf152e6a42a184")
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) and returned Tensor, ndim 4, dtype family float, shape (2, 8, 12, 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)

# Parameters for window_reverse
# windows: (num_windows*B, window_size, window_size, C)
# The function expects windows to be partitioned from an image of size (B, H, W, C)
# where the image is divided into non-overlapping windows of size window_size x window_size

B = 2  # batch size
H = 8  # image height
W = 12  # image width
window_size = 4  # window size
C = 3  # number of channels

# Calculate number of windows
num_windows_h = H // window_size  # 2
num_windows_w = W // window_size  # 3
num_windows = num_windows_h * num_windows_w  # 6

# windows shape: (num_windows*B, window_size, window_size, C)
# = (6*2, 4, 4, 3) = (12, 4, 4, 3)
windows = torch.randn(num_windows * B, window_size, window_size, C)

ARGS = {
    "windows": windows,
    "window_size": window_size,
    "H": H,
    "W": W,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, 8, 12, 3) — shape (2, 8, 12, 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
build_model Not yet run
unverified (harvested, no recorded run)
mulinmeng/Shuffle-Transformer/models/build.py
code served (permissive licence) · get_code("2448a1ccdc5ce4aa")
How it ran

no invocation recorded.

get_config Not yet run
unverified (harvested, no recorded run)
mulinmeng/Shuffle-Transformer/config.py
code served (permissive licence) · get_code("02a9e80c2bb81815")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 11 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 10 the same month, 11 later) and 1 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
window_reverse 227 other papers
6 dated earlier, 7 the same month, 214 later · 34 only as an assembly brick
1608.03983 (2016-08)
SGDR: Stochastic Gradient Descent with Warm Restarts
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 224 more not named here
window_partition 223 other papers
6 dated earlier, 7 the same month, 210 later · 32 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 220 more not named here
get_config 51 other papers
1 dated earlier, 3 the same month, 47 later
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
and 48 more not named here
create_logger 35 other papers
1 dated earlier, 2 the same month, 32 later
2104.13840 (2021-04)
Twins: Revisiting the Design of Spatial Attention in Vision Transformers
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
and 32 more not named here
check_keywords_in_name 31 other papers
1 dated earlier, 2 the same month, 28 later
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
and 28 more not named here
get_grad_norm 23 other papers
2 dated earlier, 1 the same month, 20 later
1910.13616 (2019-10)
Multimodal Model-Agnostic Meta-Learning via Task-Aware Modulation
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
and 20 more not named here
auto_resume_helper 20 other papers
1 dated earlier, 1 the same month, 18 later
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
2107.08391 (2021-07)
AS-MLP: An Axial Shifted MLP Architecture for Vision
and 17 more not named here
set_weight_decay 14 other papers
1 dated earlier, 2 the same month, 11 later
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
and 11 more not named here
build_scheduler 13 other papers
2 the same month, 11 later
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
2107.08391 (2021-07)
AS-MLP: An Axial Shifted MLP Architecture for Vision
and 10 more not named here
build_optimizer 8 other papers
2 the same month, 6 later
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2106.04263 (2021-06)
On the Connection between Local Attention and Dynamic Depth-wise Convolution
2107.08391 (2021-07)
AS-MLP: An Axial Shifted MLP Architecture for Vision
and 5 more not named here
load_checkpoint 2 other papers
2 later
2107.08391 (2021-07)
AS-MLP: An Axial Shifted MLP Architecture for Vision
2207.09455 (2022-07)
To update or not to update? Neurons at equilibrium in deep models

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-22.

Repositories linked to this paper

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

Abstract

Very recently, Window-based Transformers, which computed self-attention within non-overlapping local windows, demonstrated promising results on image classification, semantic segmentation, and object detection. However, less study has been devoted to the cross-window connection which is the key element to improve the representation ability. In this work, we revisit the spatial shuffle as an efficient way to build connections among windows. As a result, we propose a new vision transformer, named Shuffle Transformer, which is highly efficient and easy to implement by modifying two lines of code. Furthermore, the depth-wise convolution is introduced to complement the spatial shuffle for enhancing neighbor-window connections. The proposed architectures achieve excellent performance on a wide range of visual tasks including image-level classification, object detection, and semantic segmentation. Code will be released for reproduction.

For agents

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

get_harvested_code_for_paper("2106.03650")
get_code_for_paper("2106.03650")
have("2106.03650")

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

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

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

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

Connect an agent — have() is free.