SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.02689 · ICLR · 2022

RegionViT: Regional-to-Local Attention for Vision Transformers

Richard Chen, Rameswar Panda, Quanfu Fan

arXiv · PDF · Open in the Atlas

Code that ran

13 of 25 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (9 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 9 have no contract verdict; 2 failures of our instrument; 12 no recorded run), 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.02689.json · badge: /api/ran/2106.02689.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
IBM/RegionViT canonical (classifier label)
classifier basis: classifier_2025
6 ran · 3 no recorded run
dc3ea9f/RegionViT community
Papers with Code archive
6 ran · 3 no recorded run
conceptofmind/Region-ViT-flax community
Papers with Code archive
1 ran · 6 no recorded run
FunctionStatusWhere it lives
AttentionWithRelPos Ran
ran on a synthesized input · constructed an object; no result was computed
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("c7197ed401e12d9c")
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, AttentionWithRelPos: 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
from timm.models.layers import to_2tuple, trunc_normal_, DropPath

torch.manual_seed(0)

# Create a simple attention module instance
dim = 64
num_heads = 8
qkv_bias = True
qk_scale = None
attn_drop = 0.1
proj_drop = 0.1
attn_map_dim = (8, 8)  # 2D spatial dimensions for relative position
num_cls_tokens = 1

ARGS = {
    "dim": dim,
    "num_heads": num_heads,
    "qkv_bias": qkv_bias,
    "qk_scale": qk_scale,
    "attn_drop": attn_drop,
    "proj_drop": proj_drop,
    "attn_map_dim": attn_map_dim,
    "num_cls_tokens": num_cls_tokens,
}
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 AttentionWithRelPos — 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 AttentionWithRelPos 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
DropPath Ran
ran on a synthesized input · constructed an object; no result was computed
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("67186f084bc62090")
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, DropPath: 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
from timm.models.layers import DropPath as DropPath_

class DropPath(DropPath_):
    def extra_repr(self) -> str:
        return 'drop_prob={}'.format(self.drop_prob)

torch.manual_seed(0)

# DropPath inherits from DropPath_ which takes drop_prob as a parameter
# The __init__ signature is: __init__(self, drop_prob: float = 0., scale_by_keep: bool = True)
# We need to pass drop_prob (float) and optionally scale_by_keep (bool)

ARGS = {
    'drop_prob': 0.5,
}
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 DropPath — 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 DropPath 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
LayerNorm2d Ran
ran on a synthesized input · constructed an object; no result was computed
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("fb988c11d14bdbfc")
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, LayerNorm2d: 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)

# LayerNorm2d expects:
# - channels: int (number of channels)
# - eps: float (optional, default 1e-05)
# - elementwise_affine: bool (optional, default True)

# The forward method expects input to be a 4D tensor (batch, channels, height, width)
# and performs normalization over the channel dimension

ARGS = {
    "channels": 4,
    "eps": 1e-05,
    "elementwise_affine": True
}
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 LayerNorm2d — 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 LayerNorm2d 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
MultiHeadSelfAttention Ran
ran on a synthesized input · constructed an object; no result was computed
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("02fc42edbfdbea41")
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, MultiHeadSelfAttention: 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
from timm.models.layers import to_2tuple, trunc_normal_

torch.manual_seed(0)

ARGS = {
    'dim': 8,
    'window_size': (2, 2),
    'window_num': (2, 2),
    'num_heads': 2,
    'qkv_bias': True,
    'qk_scale': None,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
}
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 MultiHeadSelfAttention — 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 MultiHeadSelfAttention 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
PatchEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("bc7dfc56f71e7a9b")
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, PatchEmbed: 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 = {
    'img_size': 224,
    'patch_size': 4,
    'in_chans': 3,
    'embed_dim': 96,
    'norm_layer': nn.LayerNorm,
    'method': '3-conv',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatchEmbed — 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 PatchEmbed 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
PatchEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("6688b31853ed31b4")
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, PatchEmbed: 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
from timm.models.layers import to_2tuple, trunc_normal_, DropPath

torch.manual_seed(0)

# Define LayerNorm2d since it's used in PatchEmbed
class LayerNorm2d(nn.Module):
    def __init__(self, channels, eps: float=1e-05, elementwise_affine: bool=True) -> None:
        super(LayerNorm2d, self).__init__()
        self.channels = channels
        self.eps = torch.tensor(eps)
        self.elementwise_affine = elementwise_affine
        if self.elementwise_affine:
            self.weight = nn.Parameter(torch.zeros(1, channels, 1, 1))
            self.bias = nn.Parameter(torch.zeros(1, channels, 1, 1))
        else:
            self.register_parameter('weight', None)
            self.register_parameter('bias', None)
        self.reset_parameters()

    def reset_parameters(self) -> None:
        if self.elementwise_affine:
            nn.init.ones_(self.weight)
            nn.init.zeros_(self.bias)

    def forward(self, input: torch.Tensor) -> torch.Tensor:
        mean = input.mean(1, keepdim=True)
        std = torch.sqrt(input.var(1, unbiased=False, keepdim=True) + self.eps)
        out = (input - mean) / std
        if self.elementwise_affine:
            out = out * self.weight + self.bias
        return out

# Define test arguments
ARGS = {
    'img_size': 224,
    'patch_size': 16,
    'in_chans': 3,
    'embed_dim': 768,
    'patch_conv_type': 'linear'
}
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 PatchEmbed — 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 PatchEmbed 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
PatchMerging Ran
ran on a synthesized input · constructed an object; no result was computed
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("77415c05ec9a1664")
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, PatchMerging: 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
from math import sqrt

torch.manual_seed(0)

# PatchMerging only takes dim as a parameter in __init__
# The forward method expects x of shape (B, H*W, C) where H == W
# We need to construct a valid input tensor for testing

# Create a small input tensor
# B=2 (batch size), H=W=4 (so H*W=16), C=4 (channels, matching dim)
B = 2
H = W = 4
C = 4
L = H * W  # 16

x = torch.randn(B, L, C)

ARGS = {
    'dim': C
}
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 PatchMerging — 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 PatchMerging 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
Projection Ran
ran on a synthesized input · constructed an object; no result was computed
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("54d188ee9d7b46be")
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, Projection: 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)

# The Projection class expects:
# - input_channels: int
# - output_channels: int
# - act_layer: a callable that returns an activation module
# - mode: str (default 'sc')

# Looking at the forward method, it processes:
# - cls_tokens: a tensor that goes through self.proj_cls
# - patch_tokens: a tensor that goes through self.proj

# The act_layer is called as act_layer() in the code, so it must be a class/callable
# that can be instantiated with no arguments to create an activation module

class SimpleActivation(nn.Module):
    """Simple activation module for testing"""
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return torch.relu(x)

ARGS = {
    'input_channels': 4,
    'output_channels': 8,
    'act_layer': SimpleActivation,
    'mode': 'sc'
}
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 Projection — 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 Projection 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
R2LAttentionPlusFFN Ran
ran on a synthesized input · constructed an object; no result was computed
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("eb1f3e402e1dc74c")
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, R2LAttentionPlusFFN: 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
from timm.models.layers import DropPath
from timm.models.vision_transformer import Mlp

torch.manual_seed(0)

# Create a minimal forward hook to capture what the function needs
input_channels = 4
output_channels = 8
kernel_size = 3
num_heads = 2
batch_size = 2
height = 3
width = 3

# Create input tensor: (B*H*W + 1, C) where +1 is for cls token
# Total sequence length = 1 + (H*W) = 1 + 9 = 10
num_patches = height * width
seq_len = 1 + num_patches  # 10
xs_input = torch.randn(batch_size * seq_len, input_channels)

# Reshape to match what forward expects
# forward expects (out, B, H, W, mask)
# out should be (batch_size * seq_len, input_channels)
out = xs_input
B = batch_size
H = height
W = width

# Create mask: (batch_size, 1, seq_len, seq_len)
mask = torch.ones(batch_size, 1, seq_len, seq_len)

xs = (out, B, H, W, mask)

ARGS = {
    'input_channels': input_channels,
    'output_channels': output_channels,
    'kernel_size': kernel_size,
    'num_heads': num_heads,
    'mlp_ratio': 1.0,
    'qkv_bias': False,
    'qk_scale': None,
    'act_layer': nn.GELU,
    'norm_layer': nn.LayerNorm,
    'drop_path': 0.0,
    'attn_drop': 0.0,
    'drop': 0.0,
    'cls_attn': True,
}
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 R2LAttentionPlusFFN — 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 R2LAttentionPlusFFN 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
convert_to_flatten_layout Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("b3f0623f46fcc9af")
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 tuple. 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.functional as F

torch.manual_seed(0)

# Create small tensors with distinct dimensions
# cls_tokens: (B, C, H_ks, W_ks)
# patch_tokens: (B, C, H, W)
# ws: window size (scalar)

B = 2
C = 4
H_ks = 3
W_ks = 3
H = 12
W = 12
ws = 4

cls_tokens = torch.randn(B, C, H_ks, W_ks)
patch_tokens = torch.randn(B, C, H, W)

ARGS = {
    "cls_tokens": cls_tokens,
    "patch_tokens": patch_tokens,
    "ws": ws,
}
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 tuple — a tuple output has no array shape of its own; none is 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
divisible_by Ran
ran, violated the contract we drafted
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("cc47cc901f6ee6ea")
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 bool, 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

torch.manual_seed(0)

ARGS = {
    "val": 10,
    "d": 2
}
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 bool, 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
get_2d_relative_position_index Ran
ran, honoured the contract we drafted
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("0936ade4b0df66b9")
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 2, dtype family int, shape (12, 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 takes two integer parameters: H (height) and W (width)
# It computes relative position indices for a 2D window
# Looking at the function body:
# - H and W are used with torch.arange() to create coordinate tensors
# - They are used in arithmetic operations (H - 1, W - 1, 2 * W - 1)
# - The function returns a tensor of shape (H*W, H*W)

ARGS = {
    "H": 4,
    "W": 3,
}
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 2, dtype family int, shape (12, 12) — shape (12, 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
remap_position_index Ran
ran; our contract draft was wrong, not the code
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("b572c48319c37542")
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 tuple. 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

torch.manual_seed(0)

# Create a small position index tensor of shape (H, W)
# This represents relative position indices for a spatial grid
H, W = 4, 3
position_index = torch.tensor([
    [0, 1, 2],
    [1, 2, 3],
    [2, 3, 4],
    [3, 4, 5]
], dtype=torch.long)

ARGS = {
    "position_index": position_index,
    "shift": 0
}
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 tuple — a tuple output has no array shape of its own; none is 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
Attention Not yet run
unverified (harvested, no recorded run)
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("43d3378c696e6de4")
How it ran

no invocation recorded.

BasicLayer Not yet run
unverified (harvested, no recorded run)
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("23ae2961428275c4")
How it ran

no invocation recorded.

ConvAttBlock Not yet run
unverified (harvested, no recorded run)
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("fbf61a6af6d13754")
How it ran

no invocation recorded.

Downsample Not yet run
unverified (harvested, no recorded run)
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("ddaf1aef43c3e9f2")
How it ran

no invocation recorded.

MLP Not yet run
unverified (harvested, no recorded run)
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("4a180adb3206c763")
How it ran

no invocation recorded.

PEG Not yet run
unverified (harvested, no recorded run)
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("701acfe4475d1a8d")
How it ran

no invocation recorded.

R2LEncoderBlock Not yet run
unverified (harvested, no recorded run)
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("90fc7131c656ed6b")
How it ran

no invocation recorded.

R2LTransformer Not yet run
unverified (harvested, no recorded run)
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("7b8ebb406d076c7a")
How it ran

no invocation recorded.

RegionViT Not yet run
unverified (harvested, no recorded run)
dc3ea9f/RegionViT/models/region_vit.py
code served (permissive licence) · get_code("d872e0d4743209a6")
How it ran

no invocation recorded.

RegionViT Not yet run
unverified (harvested, no recorded run)
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("9717421cdc52208a")
How it ran

no invocation recorded.

RegionViT Not yet run
unverified (harvested, no recorded run)
conceptofmind/Region-ViT-flax/region_vit_flax.py
code served (permissive licence) · get_code("eda0483677e50eae")
How it ran

no invocation recorded.

convert_to_spatial_layout Not yet run
unverified (harvested, no recorded run)
IBM/RegionViT/regionvit/regionvit.py
code served (permissive licence) · get_code("cc95bcc461e63789")
How it ran

no invocation recorded.

Also present in other papers' code

Of 25 samples lifted from this paper's linked repositories, 25 carry a function identity and 0 do not. Of the 25 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 25 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.

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

Vision transformer (ViT) has recently shown its strong capability in achieving comparable results to convolutional neural networks (CNNs) on image classification. However, vanilla ViT simply inherits the same architecture from the natural language processing directly, which is often not optimized for vision applications. Motivated by this, in this paper, we propose a new architecture that adopts the pyramid structure and employ novel regional-to-local attention rather than global self-attention in vision transformers. More specifically, our model first generates regional tokens and local tokens from an image with different patch sizes, where each regional token is associated with a set of local tokens based on the spatial location. The regional-to-local attention includes two steps: first, the regional selfattention extracts global information among all regional tokens and then the local self-attention exchanges the information among one regional token and the associated local tokens via self-attention. Therefore, even though local self-attention confines the scope in a local region but it can still receive global information. Extensive experiments on four vision tasks, including image classification, object and keypoint detection, semantics segmentation and action recognition, show that our approach outperforms or is on par with state-of-the-art ViT variants including many concurrent works. Our source codes and models are available at https://github.com/IBM/RegionViT.

For agents

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

get_harvested_code_for_paper("2106.02689")
get_code_for_paper("2106.02689")
have("2106.02689")

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

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

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

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

Connect an agent — have() is free.