SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2101.11986 · ICCV · 2021

Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet

Weihao Yu, Zihang Jiang, Jiashi Feng, Li Yuan, Tao Wang, Shuicheng Yan, Yujun Shi, Francis Tay, Yunpeng Chen

arXiv · PDF · Open in the Atlas

Code that ran

21 of 26 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (16 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 20 have no contract verdict; 0 failures of our instrument; 5 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/2101.11986.json · badge: /api/ran/2101.11986.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
ttt496/vit-pytorch community
Papers with Code archive
7 ran · 0 no recorded run
conceptofmind/Token-to-Token-ViT-flax community
Papers with Code archive
6 ran · 1 no recorded run
yitu-opensource/T2T-ViT marked official in Papers with Code
Papers with Code archive
4 ran · 2 no recorded run
tianhai123/vit-pytorch community
Papers with Code archive
2 ran · 1 no recorded run
Shaunlipy/T2T_VIT community
Papers with Code archive
1 ran · 1 no recorded run
ahmedelmahy/myownvit community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("26b673d7f271bb3d")
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, Attention: 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 einops import rearrange, repeat
from torch import einsum

torch.manual_seed(0)

# Construct a minimal input tensor that satisfies the forward pass
# Shape: (batch_size=2, sequence_length=3, dim=4)
x = torch.randn(2, 3, 4)

ARGS = {
    "dim": 4,
    "heads": 2,
    "dim_head": 2,
    "dropout": 0.1,
}
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 Attention — 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 Attention 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
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("c5be8ba345dd9a2b")
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, Attention: 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 jax
import jax.numpy as jnp
from jax import random

# Set seed for reproducibility
key = random.PRNGKey(0)

# Define ARGS dict with all parameters for Attention module
ARGS = {
    "dim": 4,
    "heads": 2,
    "dim_head": 2,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Attention — 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 Attention 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
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
yitu-opensource/T2T-ViT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("bb63e3aa0e13762e")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, yitu-opensource/T2T-ViT (NOASSERTION). 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.

Attention Ran
ran on a synthesized input
tianhai123/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("6f1ffa7354716396")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 5, 16) 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
from torch import nn
from einops import rearrange, repeat
import torch.nn.functional as F
from torch import einsum

class Attention(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.to_qkv = nn.Linear(dim, inner_dim * 3, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, x, mask=None):
        b, n, _, h = (*x.shape, self.heads)
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), qkv)
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        mask_value = -torch.finfo(dots.dtype).max
        if mask is not None:
            mask = F.pad(mask.flatten(1), (1, 0), value=True)
            assert mask.shape[-1] == dots.shape[-1], 'mask has incorrect dimensions'
            mask = rearrange(mask, 'b i -> b () i ()') * rearrange(mask, 'b j -> b () () j')
            dots.masked_fill_(~mask, mask_value)
            del mask
        attn = dots.softmax(dim=-1)
        out = einsum('b h i j, b h j d -> b h i d', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        out = self.to_out(out)
        return out


INIT_ARGS = {
    'dim': 16,
    'heads': 2,
    'dim_head': 8,
    'dropout': 0.1,
}

ARGS = {
    'x': torch.randn(2, 5, 16),
    'mask': None,
}

if __name__ == '__main__':
    attention = Attention(**INIT_ARGS)
    output = attention(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 5, 16)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 16) — shape (2, 5, 16) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
FeedForward Ran
ran on a synthesized input · constructed an object; no result was computed
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("c17d96c99b861de1")
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
from torch import nn

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "hidden_dim": 8,
    "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 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
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("b261477eb5f9d3a4")
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 jax
import jax.numpy as jnp
import flax.linen as nn

# Set random seed for reproducibility
key = jax.random.PRNGKey(0)

# Define the arguments for FeedForward
ARGS = {
    "dim": 4,
    "hidden_dim": 8,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — 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 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
PreNorm Ran
ran on a synthesized input · constructed an object; no result was computed
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("005532cda6b215dd")
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, PreNorm: 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 PreNorm class wraps a function fn and applies LayerNorm before calling it.
# The forward method calls self.fn(self.norm(x), **kwargs)
# So fn needs to be a callable module that accepts a normalized tensor and optional kwargs.

class SimpleModule(nn.Module):
    """A simple module that processes normalized input"""
    def __init__(self, dim):
        super().__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x, **kwargs):
        return self.linear(x)

dim = 4
fn = SimpleModule(dim)

ARGS = {
    'dim': dim,
    'fn': fn
}
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 PreNorm — 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 PreNorm 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
PreNorm Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("da6e96393b45305a")
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, PreNorm: 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 jax
import jax.numpy as jnp
import flax.linen as nn
from typing import Callable

# Define a simple callable function that will be used as the fn parameter
class SimpleMLP(nn.Module):
    @nn.compact
    def __call__(self, x, **kwargs):
        x = nn.Dense(3)(x)
        return x

# Create the callable function
fn = SimpleMLP()

ARGS = {
    "fn": fn,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PreNorm — 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 PreNorm 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
RearrangeImage Ran
ran on a synthesized input
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("c0c9235b40027a60")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float; 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 math
from torch import nn
from einops import rearrange, repeat

class RearrangeImage(nn.Module):

    def forward(self, x):
        return rearrange(x, 'b (h w) c -> b c h w', h=int(math.sqrt(x.shape[1])))

# RearrangeImage.__init__ takes no parameters (only self)
INIT_ARGS = {}

# forward takes x with shape (b, h*w, c) where h*w must be a perfect square
# Using b=2, h=3, w=3 (so h*w=9), c=4
ARGS = {
    'x': torch.randn(2, 9, 4)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, 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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
RearrangeUnfoldTransformer Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("e21b062fec33b4d7")
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, RearrangeUnfoldTransformer: 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 jax
import jax.numpy as jnp
from jax import random
import flax.linen as nn
import math

# Set seed for reproducibility
key = random.PRNGKey(0)

# Define ARGS dictionary with all parameters for RearrangeUnfoldTransformer
ARGS = {
    "is_first": True,
    "is_last": False,
    "kernel_size": 3,
    "stride": 1,
    "dim": 4,
    "heads": 2,
    "depth": 1,
    "dim_head": 2,
    "mlp_dim": 8,
    "dropout": 0.1,
}

# Create a small input tensor for testing
# Shape: (batch=2, sequence_length=16, channels=4)
# sequence_length=16 because sqrt(16)=4, which gives us a 4x4 spatial grid
input_tensor = jnp.ones((2, 16, 4), dtype=jnp.float32)

# Store the input tensor for use in execution
test_input = input_tensor
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, flax, jax, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RearrangeUnfoldTransformer — 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 RearrangeUnfoldTransformer 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
T2TViT Ran
ran on a synthesized input · constructed an object; no result was computed
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("f8c201eeb0cfec0a")
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, T2TViT: 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 einops import rearrange, repeat
from einops.layers.torch import Rearrange
import math

torch.manual_seed(0)

ARGS = {
    'image_size': 32,
    'num_classes': 10,
    'dim': 64,
    'depth': 2,
    'heads': 4,
    'mlp_dim': 128,
    'pool': 'cls',
    'channels': 3,
    'dim_head': 16,
    'dropout': 0.1,
    'emb_dropout': 0.1,
    'transformer': None,
    't2t_layers': ((7, 4), (3, 2), (3, 2))
}
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 T2TViT — 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 T2TViT 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
T2TViT Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("55d063282d6be0d2")
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, T2TViT: 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 jax
import jax.numpy as jnp
import flax.linen as nn
from typing import Any

ARGS = {
    'image_size': 32,
    'num_classes': 10,
    'dim': 64,
    'depth': 2,
    'heads': 4,
    'mlp_dim': 128,
    'pool': 'cls',
    'channels': 3,
    'dim_head': 16,
    'dropout': 0.1,
    'emb_dropout': 0.1,
    'transformer': None,
    't2t_layers': ((7, 4), (3, 2), (3, 2)),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, flax, jax, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type T2TViT — 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 T2TViT 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
T2TViT Ran
ran on a synthesized input
ahmedelmahy/myownvit/vit_pytorch/t2t.py
code served (permissive licence) · get_code("7e22b681466bb3b8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; 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 math

# INIT_ARGS for T2TViT.__init__
INIT_ARGS = {
    'image_size': 32,
    'num_classes': 10,
    'dim': 64,
    'depth': 2,
    'heads': 4,
    'mlp_dim': 128,
    'pool': 'cls',
    'channels': 3,
    'dim_head': 16,
    'dropout': 0.1,
    'emb_dropout': 0.1,
    'transformer': None,
    't2t_layers': ((7, 4), (3, 2), (3, 2))
}

# ARGS for T2TViT.forward
ARGS = {
    'img': torch.randn(2, 3, 32, 32)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, 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 float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
T2T_module Ran
ran on a synthesized input · constructed an object; no result was computed
yitu-opensource/T2T-ViT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("5284a1760a5fa238")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, yitu-opensource/T2T-ViT (NOASSERTION). 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.

T2T_module Ran
ran on a synthesized input · constructed an object; no result was computed
Shaunlipy/T2T_VIT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("ee29036e4296eef5")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, Shaunlipy/T2T_VIT (NOASSERTION). 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.

Token_performer Ran
ran on a synthesized input · constructed an object; no result was computed
yitu-opensource/T2T-ViT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("755008532b287d3b")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, yitu-opensource/T2T-ViT (NOASSERTION). 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.

Token_transformer Ran
ran on a synthesized input · constructed an object; no result was computed
yitu-opensource/T2T-ViT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("2ec03ab6d47405ef")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, yitu-opensource/T2T-ViT (NOASSERTION). 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.

Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("517882a6d04b7940")
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, Transformer: 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 einops import rearrange, repeat

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "depth": 2,
    "heads": 2,
    "dim_head": 2,
    "mlp_dim": 8,
    "dropout": 0.1,
}
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 Transformer — 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 Transformer 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
Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("3b4d51835157c831")
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, Transformer: 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 jax
import jax.numpy as jnp

# Set seed for reproducibility
key = jax.random.PRNGKey(0)

# Define ARGS dict with all parameters for Transformer
ARGS = {
    'dim': 64,
    'depth': 2,
    'heads': 4,
    'dim_head': 16,
    'mlp_dim': 128,
    'dropout': 0.1
}

# Create a small input tensor for testing
# Shape: (batch=2, sequence_length=8, dim=64)
x = jnp.ones((2, 8, 64))
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Transformer — 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 Transformer 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
Transformer Ran
ran on a synthesized input
tianhai123/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("6f5a43d0a77a9794")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) 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
from torch import nn
from einops import rearrange, repeat
import torch.nn.functional as F
from torch import einsum

class Attention(nn.Module):

    def __init__(self, dim, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.to_qkv = nn.Linear(dim, inner_dim * 3, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, x, mask=None):
        b, n, _, h = (*x.shape, self.heads)
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), qkv)
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        mask_value = -torch.finfo(dots.dtype).max
        if mask is not None:
            mask = F.pad(mask.flatten(1), (1, 0), value=True)
            assert mask.shape[-1] == dots.shape[-1], 'mask has incorrect dimensions'
            mask = rearrange(mask, 'b i -> b () i ()') * rearrange(mask, 'b j -> b () () j')
            dots.masked_fill_(~mask, mask_value)
            del mask
        attn = dots.softmax(dim=-1)
        out = einsum('b h i j, b h j d -> b h i d', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        out = self.to_out(out)
        return out

class FeedForward(nn.Module):

    def __init__(self, dim, hidden_dim, dropout=0.0):
        super().__init__()
        self.net = nn.Sequential(nn.Linear(dim, hidden_dim), nn.GELU(), nn.Dropout(dropout), nn.Linear(hidden_dim, dim), nn.Dropout(dropout))

    def forward(self, x):
        return self.net(x)

class PreNorm(nn.Module):

    def __init__(self, dim, fn):
        super().__init__()
        self.norm = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, x, **kwargs):
        return self.fn(self.norm(x), **kwargs)

class Residual(nn.Module):

    def __init__(self, fn):
        super().__init__()
        self.fn = fn

    def forward(self, x, **kwargs):
        return self.fn(x, **kwargs) + x

class Transformer(nn.Module):

    def __init__(self, dim, depth, heads, dim_head, mlp_dim, dropout=0.0):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([Residual(PreNorm(dim, Attention(dim, heads=heads, dim_head=dim_head, dropout=dropout))), Residual(PreNorm(dim, FeedForward(dim, mlp_dim, dropout=dropout)))]))

    def forward(self, x, mask=None):
        for attn, ff in self.layers:
            x = attn(x, mask=mask)
            x = ff(x)
        return x


INIT_ARGS = {
    'dim': 4,
    'depth': 2,
    'heads': 2,
    'dim_head': 2,
    'mlp_dim': 8,
    'dropout': 0.0
}

ARGS = {
    'x': torch.randn(2, 3, 4),
    'mask': None
}

if __name__ == '__main__':
    model = Transformer(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3, 4)")
    assert output.shape == (2, 3, 4), f"Shape mismatch: {output.shape}"
    print("Test passed!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
conv_output_size Ran
ran, honoured the contract we drafted
ttt496/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("2160b3abdb219b68")
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 int, ndim 0, dtype family int, 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 numpy as np

torch.manual_seed(0)

# The function conv_output_size takes 4 parameters:
# - image_size: int representing the input image dimension
# - kernel_size: int representing the kernel/filter size
# - stride: int representing the stride of the convolution
# - padding: int representing the padding applied to the input

# All parameters are simple integers used in arithmetic operations
ARGS = {
    "image_size": 32,
    "kernel_size": 3,
    "stride": 1,
    "padding": 1
}
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 int, ndim 0, dtype family int, 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
Block Not yet run
unverified (harvested, no recorded run)
yitu-opensource/T2T-ViT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("4e7b29e9c82cf102")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, yitu-opensource/T2T-ViT (NOASSERTION). 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. No invocation recorded.

IdentityLayer Not yet run
unverified (harvested, no recorded run)
conceptofmind/Token-to-Token-ViT-flax/t2t.py
code served (permissive licence) · get_code("e38ae21b52d727dd")
How it ran

no invocation recorded.

T2TViT Not yet run
unverified (harvested, no recorded run)
tianhai123/vit-pytorch/vit_pytorch/t2t.py
code served (permissive licence) · get_code("2ecf8983d7a2547b")
How it ran

no invocation recorded.

T2T_ViT Not yet run
unverified (harvested, no recorded run)
yitu-opensource/T2T-ViT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("cd6a8b763f979637")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, yitu-opensource/T2T-ViT (NOASSERTION). 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. No invocation recorded.

T2T_ViT Not yet run
unverified (harvested, no recorded run)
Shaunlipy/T2T_VIT/models/t2t_vit.py
pointer only (licence: NOASSERTION) · get_code("7e2445af0025404a")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, Shaunlipy/T2T_VIT (NOASSERTION). 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. No invocation recorded.

Also present in other papers' code

Of 26 samples lifted from this paper's linked repositories, 26 carry a function identity and 0 do not. Of the 23 distinct functions with an identity, 11 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 11 later) and 12 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
PreNorm
brick of this paper's assembly: helper, model
43 other papers
2 dated earlier, 41 later · 38 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2103.00112 (2021-03)
Transformer in Transformer
and 40 more not named here
FeedForward
brick of this paper's assembly: helper, model
27 other papers
1 dated earlier, 26 later · 25 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2103.11816 (2021-03)
Incorporating Convolution Designs into Visual Transformers
2103.14899 (2021-03)
CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification
and 24 more not named here
Block
brick of this paper's assembly: model
12 other papers
1 dated earlier, 11 later · 4 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2103.10455 (2021-03)
3D Human Pose Estimation with Spatial and Temporal Transformers
2104.12099 (2021-04)
Visual Saliency Transformer
and 9 more not named here
Transformer
brick of this paper's assembly: helper, model
11 other papers
1 dated earlier, 10 later · 2 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2103.14899 (2021-03)
CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification
2103.16302 (2021-03)
Rethinking Spatial Dimensions of Vision Transformers
and 8 more not named here
PreNorm
brick of this paper's assembly: model
4 other papers
4 later · 2 only as an assembly brick
2103.14899 (2021-03)
CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification
2103.15808 (2021-03)
CvT: Introducing Convolutions to Vision Transformers
2103.16302 (2021-03)
Rethinking Spatial Dimensions of Vision Transformers
and 1 more not named here
FeedForward
brick of this paper's assembly: model
2 other papers
2 later · 2 only as an assembly brick
2103.14899 (2021-03)
CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification
2103.16302 (2021-03)
Rethinking Spatial Dimensions of Vision Transformers
IdentityLayer
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later · 1 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2106.02689 (2021-06)
RegionViT: Regional-to-Local Attention for Vision Transformers
Attention
brick of this paper's assembly: helper
1 other paper
1 later
2103.16302 (2021-03)
Rethinking Spatial Dimensions of Vision Transformers
Attention
brick of this paper's assembly: model
1 other paper
1 later
2108.06693 (2021-08)
Exploring Temporal Coherence for More General Video Face Forgery Detection
Token_transformer
brick of this paper's assembly: model
1 other paper
1 later
2104.12099 (2021-04)
Visual Saliency Transformer
Transformer
brick of this paper's assembly: model
1 other paper
1 later
2108.06693 (2021-08)
Exploring Temporal Coherence for More General Video Face Forgery Detection

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, which are popular for language modeling, have been explored for solving vision tasks recently, e.g., the Vision Transformer (ViT) for image classification. The ViT model splits each image into a sequence of tokens with fixed length and then applies multiple Transformer layers to model their global relation for classification. However, ViT achieves inferior performance to CNNs when trained from scratch on a midsize dataset like ImageNet. We find it is because: 1) the simple tokenization of input images fails to model the important local structure such as edges and lines among neighboring pixels, leading to low training sample efficiency; 2) the redundant attention backbone design of ViT leads to limited feature richness for fixed computation budgets and limited training samples. To overcome such limitations, we propose a new Tokens-To-Token Vision Transformer (T2T-ViT), which incorporates 1) a layerwise Tokens-to-Token (T2T) transformation to progressively structurize the image to tokens by recursively aggregating neighboring Tokens into one Token (Tokens-to-Token), such that local structure represented by surrounding tokens can be modeled and tokens length can be reduced; 2) an efficient backbone with a deep-narrow structure for vision transformer motivated by CNN architecture design after empirical study. Notably, T2T-ViT reduces the parameter count and MACs of vanilla ViT by half, while achieving more than 3.0% improvement when trained from scratch on ImageNet. It also outperforms ResNets and achieves comparable performance with MobileNets by directly training on ImageNet. For example, T2T-ViT with comparable size to ResNet50 (21.5M parameters) can achieve 83.3% top1 accuracy in image resolution 384×384 on ImageNet. 1 * Work done during an internship at Yitu Tech.

For agents

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

get_harvested_code_for_paper("2101.11986")
get_code_for_paper("2101.11986")
have("2101.11986")

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

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

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

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

Connect an agent — have() is free.