SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.01136 · ICCV · 2021

LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference

Armand Joulin, Matthijs Douze, Pierre Stock, Hugo Touvron, Hervé Jégou, Alaaeldin El-Nouby, Ben Graham

arXiv · PDF · Open in the Atlas

Code that ran

23 of 30 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; 3 honoured the contract we drafted, 1 violated it and 17 have no contract verdict; 2 failures of our instrument; 7 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2104.01136.json · badge: /api/ran/2104.01136.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
gatech-eic/vitcod community
Papers with Code archive
8 ran · 3 no recorded run
ahmedelmahy/myownvit community
Papers with Code archive
6 ran · 0 no recorded run
conceptofmind/LeViT-flax community
Papers with Code archive
4 ran · 1 no recorded run
facebookresearch/LeViT marked official in Papers with Code
Papers with Code archive
3 ran · 1 no recorded run
ttt496/vit-pytorch community
Papers with Code archive
1 ran · 2 no recorded run
JoegameZhou/Levit community (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/levit.py
code served (permissive licence) · get_code("1e3d5a2962c6d68e")
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
from torch import nn

torch.manual_seed(0)

ARGS = {
    'dim': 4,
    'fmap_size': 8,
    'heads': 2,
    'dim_key': 2,
    'dim_value': 3,
    'dropout': 0.1,
    'dim_out': 5,
    'downsample': False,
}
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
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("a70f356fb000eeaf")
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

torch.manual_seed(0)

# Create a simple activation function
activation = nn.ReLU

# Define ARGS with all parameters for Attention.__init__
ARGS = {
    'dim': 64,
    'key_dim': 8,
    'num_heads': 4,
    'attn_ratio': 4,
    'activation': activation,
    'resolution': 14,
    'need_weight': False,
    'attn_mask': None,
    'svd_type': 'mix_head_fc_qk',
}
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 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
facebookresearch/LeViT/levit.py
code served (permissive licence) · get_code("f75bc648af8ba051")
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

torch.manual_seed(0)

# Define a minimal activation function that the code expects
class MinimalActivation(nn.Module):
    def forward(self, x):
        return torch.relu(x)

def minimal_activation():
    return MinimalActivation()

# Build the ARGS dictionary with all required parameters for Attention.__init__
ARGS = {
    'dim': 16,
    'key_dim': 4,
    'num_heads': 2,
    'attn_ratio': 2,
    'activation': minimal_activation,
    'resolution': 4,
}
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 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/LeViT-flax/levit.py
code served (permissive licence) · get_code("9a030b11684381a9")
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
import flax.linen as nn

def exists(val):
    return val is not None

def default(val, d):
    return val if exists(val) else d

def jax_unstack(x, axis=0):
    return jnp.moveaxis(x, axis, 0)

# Set seed for reproducibility
jax.config.update("jax_default_prng_impl", "threefry2x32")
key = jax.random.PRNGKey(0)

# Create a small input tensor: batch=2, height=4, width=4, channels=16
batch_size = 2
fmap_size = 4
channels = 16
x = jax.random.normal(key, (batch_size, fmap_size, fmap_size, channels))

# Define the Attention module arguments
ARGS = {
    "dim": 16,
    "fmap_size": 4,
    "heads": 2,
    "dim_key": 4,
    "dim_value": 8,
    "dropout": 0.1,
    "dim_out": 16,
    "downsample": False,
}
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
AttentionSubsample Ran
ran on a synthesized input · constructed an object; no result was computed
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("1483bc0115c957b4")
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, AttentionSubsample: 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)

class DummyActivation(nn.Module):
    def forward(self, x):
        return torch.relu(x)

ARGS = {
    'in_dim': 4,
    'out_dim': 5,
    'key_dim': 3,
    'num_heads': 8,
    'attn_ratio': 2,
    'activation': DummyActivation,
    'stride': 2,
    'resolution': 14,
    'resolution_': 7,
    'need_weight': False,
    'attn_mask': None,
    'svd_type': 'mix_head_fc_qk'
}
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 AttentionSubsample — 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 AttentionSubsample 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
AttentionSubsample Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/LeViT/levit.py
code served (permissive licence) · get_code("1fc862a8415abe13")
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, AttentionSubsample: 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)

class DummyActivation(nn.Module):
    def forward(self, x):
        return torch.relu(x)

ARGS = {
    'in_dim': 4,
    'out_dim': 5,
    'key_dim': 3,
    'num_heads': 2,
    'attn_ratio': 2,
    'activation': DummyActivation,
    'stride': 2,
    'resolution': 14,
    'resolution_': 7,
}
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 AttentionSubsample — 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 AttentionSubsample 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
BN_Linear Ran
ran on a synthesized input · constructed an object; no result was computed
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("1f62c224d093c749")
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, BN_Linear: 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 timm.models.vision_transformer import trunc_normal_

torch.manual_seed(0)

ARGS = {
    'a': 4,
    'b': 3,
    'bias': True,
    'std': 0.02,
}
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 BN_Linear — 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 BN_Linear output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FeedForward Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/levit.py
code served (permissive licence) · get_code("fe5a9a73766eb1f4")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'dim': 4,
    'mult': 2,
    '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
ttt496/vit-pytorch/vit_pytorch/levit.py
code served (permissive licence) · get_code("8e82526051003880")
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, shape (2, 4, 3, 5) 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

class FeedForward(nn.Module):

    def __init__(self, dim, mult, dropout=0.0):
        super().__init__()
        self.net = nn.Sequential(nn.Conv2d(dim, dim * mult, 1), nn.GELU(), nn.Dropout(dropout), nn.Conv2d(dim * mult, dim, 1), nn.Dropout(dropout))

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


INIT_ARGS = {
    'dim': 4,
    'mult': 2,
    'dropout': 0.1,
}

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

if __name__ == '__main__':
    model = FeedForward(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 5) 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)
LeViT Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/levit.py
code served (permissive licence) · get_code("c571a7adc6cce77a")
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, LeViT: 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 = {
    'image_size': 224,
    'num_classes': 10,
    'dim': 64,
    'depth': 2,
    'heads': 4,
    'mlp_mult': 2,
    'stages': 2,
    'dim_key': 32,
    'dim_value': 64,
    'dropout': 0.1,
    'num_distill_classes': None,
}
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 LeViT — 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 LeViT 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
LeViT Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/LeViT-flax/levit.py
code served (permissive licence) · get_code("9a2be313ddf53888")
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, LeViT: 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

ARGS = {
    "image_size": 224,
    "num_classes": 10,
    "dim": 4,
    "depth": 2,
    "heads": 2,
    "mlp_mult": 2,
    "stages": 2,
    "dim_key": 32,
    "dim_value": 64,
    "dropout": 0.1,
    "num_distill_classes": None,
}
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 LeViT — 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 LeViT 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
Linear_BN Ran
ran on a synthesized input · constructed an object; no result was computed
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("1e3dca9dff1d266c")
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, Linear_BN: 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 = {
    'a': 4,
    'b': 3,
    'bn_weight_init': 1.0,
    'resolution': 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 Linear_BN — 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 Linear_BN output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/LeViT-flax/levit.py
code served (permissive licence) · get_code("471a5ccd8e325eae")
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, MLP: 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

class MLP(nn.Module):
    dim: int
    mult: int
    dropout: float = 0.0

    @nn.compact
    def __call__(self, x):
        x = nn.Conv(features=self.dim * self.mult, kernel_size=(1, 1), strides=(1, 1))(x)
        x = jax.nn.hard_swish(x)
        x = nn.Dropout(rate=self.dropout)(x, deterministic=False)
        x = nn.Conv(features=self.dim, kernel_size=(1, 1), strides=(1, 1))(x)
        x = nn.Dropout(rate=self.dropout)(x, deterministic=False)
        return x

ARGS = {
    "dim": 4,
    "mult": 2,
    "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 MLP — 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 MLP 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
Residual Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/LeViT/levit.py
code served (permissive licence) · get_code("2e3b4d9ce0862869")
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, Residual: 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)

# Create a simple module that takes input and produces output
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the module
m = SimpleModule()

# Set to training mode so the dropout path is exercised
m.train()

# Define drop probability (between 0 and 1)
drop = 0.5

ARGS = {
    'm': m,
    'drop': drop
}
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 Residual — 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 Residual 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
Subsample Ran
ran on a synthesized input · constructed an object; no result was computed
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("6b31362b57a70857")
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, Subsample: 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

torch.manual_seed(0)

ARGS = {
    'stride': 2,
    'resolution': 4
}
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 Subsample — 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 Subsample 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
ahmedelmahy/myownvit/vit_pytorch/levit.py
code served (permissive licence) · get_code("50a7b63b362ab9ab")
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

torch.manual_seed(0)

# Define helper functions that are used in the module
def exists(val):
    return val is not None

def default(val, d):
    return val if exists(val) else d

# Create ARGS dictionary with all parameters for Transformer
ARGS = {
    'dim': 4,
    'fmap_size': 8,
    'depth': 2,
    'heads': 2,
    'dim_key': 2,
    'dim_value': 3,
    'mlp_mult': 2,
    'dropout': 0.1,
    'dim_out': 5,
    'downsample': False
}
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/LeViT-flax/levit.py
code served (permissive licence) · get_code("c42a6cdb12b88c28")
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
import flax.linen as nn

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

# Create small test input
# Shape: (batch, height, width, channels)
batch_size = 2
fmap_size = 4
dim = 8
x = jnp.ones((batch_size, fmap_size, fmap_size, dim))

ARGS = {
    "dim": 8,
    "fmap_size": 4,
    "depth": 2,
    "heads": 2,
    "dim_key": 4,
    "dim_value": 8,
    "mlp_mult": 2,
    "dropout": 0.1,
    "dim_out": None,
    "downsample": False,
}
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
always Ran
ran; our contract draft was wrong, not the code
ahmedelmahy/myownvit/vit_pytorch/levit.py
code served (permissive licence) · get_code("47332d86fb8b809f")
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

torch.manual_seed(0)

def always(val):
    return lambda *args, **kwargs: val

# The function 'always' takes a single parameter 'val' of any type
# and returns a lambda function that ignores all arguments and returns val.
# There are no specific attribute/method calls on val in the function body,
# so val can be any Python object.

ARGS = {
    "val": 42
}
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 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
cal_num_elements_pattern Ran
ran, honoured the contract we drafted
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("6a217c032da74a62")
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, 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

torch.manual_seed(0)

# The function expects pattern_mask to be an iterable of tensors
# Each tensor should have shape that allows indexing [:, :, 1:, 1:]
# This suggests 4D tensors with shape (batch, channels, height, width)
# We create a list of small pattern tensors with boolean/binary values

pattern_1 = torch.randint(0, 2, (2, 3, 4, 5), dtype=torch.bool)
pattern_2 = torch.randint(0, 2, (2, 3, 4, 5), dtype=torch.bool)

pattern_mask = [pattern_1, pattern_2]

ARGS = {
    "pattern_mask": pattern_mask
}
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, ndim 1, dtype family int — a tuple 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
cal_reduced_Gflops Ran
ran, honoured the contract we drafted
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("654dc28ca7504d97")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. 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)

# Analyze the function cal_reduced_Gflops:
# - pattern_mask: iterable of tensors with shape that supports:
#   - torch.numel(each_pattern)
#   - each_pattern.sum().item()
#   - each_pattern[:, :, 1:, 1:] slicing (4D tensor)
#   - each_pattern.size(2) to get N
# - L: number of layers (int)
# - C: channel dimension (int)

# Create pattern_mask as a list of 4D boolean tensors
# Shape: (batch, channels, height, width)
# Using distinct sizes: batch=2, channels=3, height=4, width=5
pattern_mask = [
    torch.randint(0, 2, (2, 3, 4, 5), dtype=torch.bool),
    torch.randint(0, 2, (2, 3, 4, 5), dtype=torch.bool),
]

# L: number of layers
L = 12

# C: channel dimension
C = 768

ARGS = {
    "pattern_mask": pattern_mask,
    "L": L,
    "C": 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 float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cast_tuple Ran
ran, honoured the contract we drafted
ahmedelmahy/myownvit/vit_pytorch/levit.py
code served (permissive licence) · get_code("15c7fd492938a25c")
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, 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

torch.manual_seed(0)

# Analyzing the function:
# - val: can be any type, will be converted to tuple if not already
# - l: integer, defaults to 3
# The function creates a tuple by:
#   1. Converting val to tuple if needed
#   2. Padding/extending it to length l using the last element

# Test cases with different val types
ARGS = {
    "val": 42,  # scalar - will become (42,) and pad to length 3
    "l": 3      # target length
}
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, ndim 1, dtype family int — a tuple 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
mask_read_files Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("66259b2558804bdd")
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 5, 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 numpy as np
import tempfile
import os

torch.manual_seed(0)

# Create a temporary numpy file with mask data
temp_dir = tempfile.mkdtemp()
filepath = os.path.join(temp_dir, 'mask.npy')

num_layers = 3
num_heads = 8
patch_size = 16
train_size_thw = (8, 16, 16)

# Create a dummy mask array with shape (num_layers, num_heads, ...)
mask_data = np.random.randint(0, 2, size=(num_layers, num_heads, 64, 64)).astype(np.uint8)
np.save(filepath, mask_data)

ARGS = {
    'train_size_thw': train_size_thw,
    'patch_size': patch_size,
    'num_heads': num_heads,
    'num_layers': num_layers,
    'filepath': filepath
}
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 list, ndim 5, 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
str2bool Ran
ran, violated the contract we drafted
JoegameZhou/Levit/config.py
code served (permissive licence) · get_code("17061f7e01a6fc86")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 argparse

def str2bool(v):
    if isinstance(v, bool):
        return v
    if v.lower() in ('yes', 'true', '1'):
        return True
    elif v.lower() in ('no', 'false', '0'):
        return False
    else:
        raise argparse.ArgumentTypeError('Boolean value expected.')

# Test with a string that should return True
ARGS = {'v': 'true'}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
none outside the standard library — 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
GlobalAvgPool Not yet run
unverified (harvested, no recorded run)
conceptofmind/LeViT-flax/levit.py
code served (permissive licence) · get_code("cb105deb9841b373")
How it ran

no invocation recorded.

LeViT Not yet run
unverified (harvested, no recorded run)
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("e527a2503227989c")
How it ran

no invocation recorded.

LeViT Not yet run
unverified (harvested, no recorded run)
facebookresearch/LeViT/levit.py
code served (permissive licence) · get_code("abad5a7ac0d6223e")
How it ran

no invocation recorded.

LeViT Not yet run
unverified (harvested, no recorded run)
ttt496/vit-pytorch/vit_pytorch/levit.py
code served (permissive licence) · get_code("faac50d91b2a1582")
How it ran

no invocation recorded.

Residual Not yet run
unverified (harvested, no recorded run)
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("37406361a9c395c4")
How it ran

no invocation recorded.

Transformer Not yet run
unverified (harvested, no recorded run)
ttt496/vit-pytorch/vit_pytorch/levit.py
code served (permissive licence) · get_code("1c076834c8e03a75")
How it ran

no invocation recorded.

print_pattern_ratio Not yet run
unverified (harvested, no recorded run)
gatech-eic/vitcod/Algorithm/levit/levit.py
code served (permissive licence) · get_code("2166b093d2de8c9d")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
str2bool 2 other papers
1 dated earlier, 1 later
2007.00992 (2020-07)
Rethinking Channel Dimensions for Efficient Model Design
2206.10589 (2022-06)
EdgeNeXt: Efficiently Amalgamated CNN-Transformer Architecture for Mobile Vision Applications
GlobalAvgPool
brick of this paper's assembly: model
1 other paper
1 dated earlier
2103.15808 (2021-03)
CvT: Introducing Convolutions to Vision Transformers
Subsample
brick of this paper's assembly: model
1 other paper
1 later · 1 only as an assembly brick
2308.10814 (2023-08)
Jumping through Local Minima: Quantization in the Loss Landscape of Vision Transformers

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

Repositories linked to this paper

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

Abstract

We design a family of image classification architectures that optimize the trade-off between accuracy and efficiency in a high-speed regime. Our work exploits recent findings in attention-based architectures, which are competitive on highly parallel processing hardware. We revisit principles from the extensive literature on convolutional neural networks to apply them to transformers, in particular activation maps with decreasing resolutions. We also introduce the attention bias, a new way to integrate positional information in vision transformers. As a result, we propose LeViT: a hybrid neural network for fast inference image classification. We consider different measures of efficiency on different hardware platforms, so as to best reflect a wide range of application scenarios. Our extensive experiments empirically validate our technical choices and show they are suitable to most architectures. Overall, LeViT significantly outperforms existing convnets and vision transformers with respect to the speed/accuracy tradeoff. For example, at 80% ImageNet top-1 accuracy, LeViT is 5 times faster than EfficientNet on CPU. We release the code at https://github.com/ facebookresearch/LeViT.

For agents

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

get_harvested_code_for_paper("2104.01136")
get_code_for_paper("2104.01136")
have("2104.01136")

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

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

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

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

Connect an agent — have() is free.