SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2108.01684 · ICCV · 2021

Vision Transformer with Progressive Sampling

Philip Torr, Dahua Lin, Wayne Zhang, Shuyang Sun, Meng Wei, Xiaoyu Yue, Zhanghui Kuang

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2108.01684.json · badge: /api/ran/2108.01684.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
yuexy/PS-ViT canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
addmm_flop_jit Ran
ran on a synthesized input
yuexy/PS-ViT/utils/flop_count/jit_handles.py
code served (permissive licence) · get_code("27b31e965ef896f1")
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 Counter. 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
from collections import Counter
from unittest.mock import Mock

torch.manual_seed(0)

# Create mock jit Value objects that behave like torch._C.Value
class MockJitValue:
    def __init__(self, shape):
        self._shape = shape
    
    def isCompleteTensor(self):
        return True
    
    def type(self):
        return Mock(sizes=lambda: self._shape)

# Create inputs and outputs lists
# addmm_flop_jit expects:
# inputs[1:3] to be two 2D tensors (it skips inputs[0])
# The function extracts shapes from inputs[1] and inputs[2]

# inputs[1] should have shape [batch_size, input_dim]
# inputs[2] should have shape [input_dim, output_dim]
mock_input_1 = MockJitValue([2, 4])  # batch_size=2, input_dim=4
mock_input_2 = MockJitValue([4, 3])  # input_dim=4, output_dim=3
mock_input_0 = MockJitValue([3])     # bias term (not used in shape extraction)

inputs = [mock_input_0, mock_input_1, mock_input_2]
outputs = []  # outputs parameter is not used in the function

ARGS = {
    'inputs': inputs,
    'outputs': outputs
}
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 Counter — a Counter output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Counter 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
conv1x1 Ran
ran; our contract draft was wrong, not the code
yuexy/PS-ViT/models/ps_vit.py
pointer only (licence: MIT); the stored copy get_code serves, from guanyuezhen/ufcd, is pointer only (licence: NONE) · get_code("6ef392f365cc5703")
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 guanyuezhen/ufcd, 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.

conv3x3 Ran
ran; our contract draft was wrong, not the code
yuexy/PS-ViT/models/ps_vit.py
pointer only (licence: MIT); the stored copy get_code serves, from lewandofskee/MambaAD, is pointer only (licence: NONE) · get_code("794a2ed91a5175bd")
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 lewandofskee/MambaAD, 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_loader Ran
ran on a synthesized input
yuexy/PS-ViT/utils/loader.py
code served (permissive licence) · get_code("1cf1c5e0f9a581ba")
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 PrefetchLoader. 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.utils.data
from torch.utils.data import Dataset

torch.manual_seed(0)

class DummyDataset(Dataset):
    def __init__(self, num_samples=4):
        self.num_samples = num_samples
        self.transform = None
    
    def __len__(self):
        return self.num_samples
    
    def __getitem__(self, idx):
        # Return (image, label) tuple
        image = torch.randn(3, 224, 224)
        label = torch.tensor(idx % 10, dtype=torch.long)
        if self.transform is not None:
            image = self.transform(image)
        return image, label

dataset = DummyDataset(num_samples=8)

ARGS = {
    'dataset': dataset,
    'input_size': 224,
    'batch_size': 2,
    'is_training': False,
    'use_prefetcher': True,
    'no_aug': False,
    're_prob': 0.0,
    're_mode': 'const',
    're_count': 1,
    're_split': False,
    'scale': None,
    'ratio': None,
    'hflip': 0.5,
    'vflip': 0.0,
    'color_jitter': 0.4,
    'auto_augment': None,
    'num_aug_splits': 0,
    'interpolation': 'bilinear',
    'mean': (0.485, 0.456, 0.406),
    'std': (0.229, 0.224, 0.225),
    'num_workers': 0,
    'distributed': False,
    'crop_pct': None,
    'collate_fn': None,
    'pin_memory': False,
    'fp16': False,
    'tf_preprocessing': False,
    'use_multi_epochs_loader': False,
    'repeated_aug': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PrefetchLoader — a PrefetchLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PrefetchLoader 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
generic_activation_jit Ran
ran on a synthesized input
yuexy/PS-ViT/utils/flop_count/jit_handles.py
code served (permissive licence) · get_code("29724655612e3ef9")
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 function. 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 numpy as np
from collections import Counter
from typing import List, Any

torch.manual_seed(0)

# Create a mock JIT Value object that has the methods called in the function
class MockJITValue:
    def __init__(self, shape):
        self._shape = shape
        self._is_complete = True
    
    def isCompleteTensor(self):
        return self._is_complete
    
    def type(self):
        return self
    
    def sizes(self):
        return self._shape

# Test the function with a mock output list
mock_outputs = [MockJITValue([2, 3, 4, 5])]

ARGS = {
    "op_name": "conv2d"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
get_shape Ran
ran on a synthesized input
yuexy/PS-ViT/utils/flop_count/jit_handles.py
code served (permissive licence) · get_code("653ac611901cfc1c")
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 list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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.jit

torch.manual_seed(0)

# Create a simple TorchScript module to get a jit Value object
class SimpleModule(torch.nn.Module):
    def forward(self, x):
        return x + 1

# Trace the module to get a jit graph
module = SimpleModule()
example_input = torch.randn(2, 4)
traced = torch.jit.trace(module, example_input)

# Extract a jit Value object from the graph
# We need to get a Value that represents a complete tensor
graph = traced.graph
for node in graph.nodes():
    for output in node.outputs():
        val = output
        break

ARGS = {
    "val": val
}
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 list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
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
dist_init Not yet run
unverified (harvested, no recorded run)
yuexy/PS-ViT/utils/distributed_utils.py
code served (permissive licence) · get_code("b2ada9fb7de2d355")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 2 the same month, 2 later) and 0 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
conv1x1 431 other papers
141 dated earlier, 7 the same month, 277 later, 5 same year, order not determinable, 1 undated · 38 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1506.01186 (2015-06)
Cyclical Learning Rates for Training Neural Networks
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
and 428 more not named here
conv3x3 312 other papers
84 dated earlier, 6 the same month, 218 later, 3 same year, order not determinable, 1 undated · 31 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
and 309 more not named here
addmm_flop_jit 1 other paper
1 dated earlier
2103.12731 (2021-03)
Scaling Local Self-Attention for Parameter Efficient Visual Backbones
create_loader 1 other paper
1 dated earlier
2103.12731 (2021-03)
Scaling Local Self-Attention for Parameter Efficient Visual Backbones
dist_init 1 other paper
1 dated earlier
2103.12731 (2021-03)
Scaling Local Self-Attention for Parameter Efficient Visual Backbones
generic_activation_jit 1 other paper
1 dated earlier
2103.12731 (2021-03)
Scaling Local Self-Attention for Parameter Efficient Visual Backbones
get_shape 1 other paper
1 dated earlier
2103.12731 (2021-03)
Scaling Local Self-Attention for Parameter Efficient Visual Backbones

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

Transformers with powerful global relation modeling abilities have been introduced to fundamental computer vision tasks recently. As a typical example, the Vision Transformer (ViT) directly applies a pure transformer architecture on image classification, by simply splitting images into tokens with a fixed length, and employing transformers to learn relations between these tokens. However, such naive tokenization could destruct object structures, assign grids to uninterested regions such as background, and introduce interference signals. To mitigate the above issues, in this paper, we propose an iterative and progressive sampling strategy to locate discriminative regions. At each iteration, embeddings of the current sampling step are fed into a transformer encoder layer, and a group of sampling offsets is predicted to update the sampling locations for the next step. The progressive sampling is differentiable. When combined with the Vision Transformer, the obtained PS-ViT network can adaptively learn where to look. The proposed PS-ViT is both effective and efficient. When trained from scratch on ImageNet, PS-ViT performs 3.8% higher than the vanilla ViT in terms of top-1 accuracy with about 4× fewer parameters and 10× fewer FLOPs. Code is available at https://github.com/yuexy/PS-ViT.

For agents

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

get_harvested_code_for_paper("2108.01684")
get_code_for_paper("2108.01684")
have("2108.01684")

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

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

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

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

Connect an agent — have() is free.