SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.15808 · ICCV · 2021

CvT: Introducing Convolutions to Vision Transformers

Lei Zhang, Lu Yuan, Xiyang Dai, Mengchen Liu, Bin Xiao, Noel Codella, Haiping Wu

arXiv · PDF · Open in the Atlas

Code that ran

39 of 47 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (19 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 1 violated it and 23 have no contract verdict; 12 failures of our instrument; 8 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/2103.15808.json · badge: /api/ran/2103.15808.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
microsoft/CvT canonical (classifier label)
classifier basis: census
10 ran · 4 no recorded run
ahmedelmahy/myownvit community
Papers with Code archive
7 ran · 0 no recorded run
microsoft/esvit community
Papers with Code archive
6 ran · 2 no recorded run
conceptofmind/CvT-flax community
Papers with Code archive
6 ran · 1 no recorded run
rishikksh20/convolution-vision-transformers community
Papers with Code archive
3 ran · 1 no recorded run
EMalagoli92/CvT-TensorFlow community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
leoxiaobin/CvT community (classifier label)
classifier basis: plan_row
2 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/cvt.py
code served (permissive licence) · get_code("991c37c831796a95")
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

torch.manual_seed(0)

ARGS = {
    'dim': 4,
    'proj_kernel': 3,
    'kv_proj_stride': 1,
    '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/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("52559df32e30ffb2")
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

# Initialize JAX random key
key = jax.random.PRNGKey(0)

# Create a small input tensor for testing
# Shape: (batch=2, height=4, width=3, channels=4)
x = jnp.ones((2, 4, 3, 4))

ARGS = {
    "dim": 4,
    "proj_kernel": 3,
    "kv_proj_stride": 1,
    "heads": 2,
    "dim_head": 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, 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
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("28bc4fb247eda528")
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)

ARGS = {
    'dim_in': 4,
    'dim_out': 8,
    'num_heads': 2,
    'qkv_bias': True,
    'kernel_size': 3,
    'padding': 1,
    'window_size': 4,
    'shift_size': 0,
    'rel_pos_embed': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
ConvAttention Ran
ran on a synthesized input
rishikksh20/convolution-vision-transformers/cvt.py
code served (permissive licence) · get_code("24f6586f5de31374")
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, 9, 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
from torch import nn, einsum

class SepConv2d(torch.nn.Module):

    def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1):
        super(SepConv2d, self).__init__()
        self.depthwise = torch.nn.Conv2d(in_channels, in_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=in_channels)
        self.bn = torch.nn.BatchNorm2d(in_channels)
        self.pointwise = torch.nn.Conv2d(in_channels, out_channels, kernel_size=1)

    def forward(self, x):
        x = self.depthwise(x)
        x = self.bn(x)
        x = self.pointwise(x)
        return x

class ConvAttention(nn.Module):

    def __init__(self, dim, img_size, heads=8, dim_head=64, kernel_size=3, q_stride=1, k_stride=1, v_stride=1, dropout=0.0, last_stage=False):
        super().__init__()
        self.last_stage = last_stage
        self.img_size = img_size
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        pad = (kernel_size - q_stride) // 2
        self.to_q = SepConv2d(dim, inner_dim, kernel_size, q_stride, pad)
        self.to_k = SepConv2d(dim, inner_dim, kernel_size, k_stride, pad)
        self.to_v = SepConv2d(dim, inner_dim, kernel_size, v_stride, pad)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, x):
        b, n, _, h = (*x.shape, self.heads)
        if self.last_stage:
            cls_token = x[:, 0]
            x = x[:, 1:]
            cls_token = rearrange(cls_token.unsqueeze(1), 'b n (h d) -> b h n d', h=h)
        x = rearrange(x, 'b (l w) n -> b n l w', l=self.img_size, w=self.img_size)
        q = self.to_q(x)
        q = rearrange(q, 'b (h d) l w -> b h (l w) d', h=h)
        v = self.to_v(x)
        v = rearrange(v, 'b (h d) l w -> b h (l w) d', h=h)
        k = self.to_k(x)
        k = rearrange(k, 'b (h d) l w -> b h (l w) d', h=h)
        if self.last_stage:
            q = torch.cat((cls_token, q), dim=2)
            v = torch.cat((cls_token, v), dim=2)
            k = torch.cat((cls_token, k), dim=2)
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        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': 4,
    'img_size': 3,
    'heads': 2,
    'dim_head': 2,
    'kernel_size': 3,
    'q_stride': 1,
    'k_stride': 1,
    'v_stride': 1,
    'dropout': 0.0,
    'last_stage': False
}

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 3, dtype family float, shape (2, 9, 4) — shape (2, 9, 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)
ConvEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("ae1afcb4cbd9e8a8")
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, ConvEmbed: 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 torch import einsum
from einops import rearrange, repeat

torch.manual_seed(0)

class ConvEmbed(nn.Module):
    """ Image to Patch Embedding
    """

    def __init__(self, patch_size=7, in_chans=3, embed_dim=64, stride=4, padding=2, norm_layer=None):
        super().__init__()
        self.patch_size = patch_size
        self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=stride, padding=padding)
        self.norm = norm_layer(embed_dim) if norm_layer else None

    def forward(self, x):
        x = self.proj(x)
        B, C, H, W = x.shape
        x = rearrange(x, 'b c h w -> b (h w) c').contiguous()
        if self.norm:
            x = self.norm(x)
        x = rearrange(x, 'b (h w) c -> b c h w', h=H, w=W).contiguous()
        return x


# Create a simple LayerNorm class to use as norm_layer
class SimpleLayerNorm(nn.Module):
    def __init__(self, num_features):
        super().__init__()
        self.norm = nn.LayerNorm(num_features)
    
    def forward(self, x):
        return self.norm(x)


ARGS = {
    'patch_size': 7,
    'in_chans': 3,
    'embed_dim': 64,
    'stride': 4,
    'padding': 2,
    'norm_layer': SimpleLayerNorm
}
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 ConvEmbed — 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 ConvEmbed 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
CvT Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/cvt.py
code served (permissive licence) · get_code("a834f7b8ea0f91fd")
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, CvT: 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 = {
    'num_classes': 10,
    's1_emb_dim': 64,
    's1_emb_kernel': 7,
    's1_emb_stride': 4,
    's1_proj_kernel': 3,
    's1_kv_proj_stride': 2,
    's1_heads': 1,
    's1_depth': 1,
    's1_mlp_mult': 4,
    's2_emb_dim': 192,
    's2_emb_kernel': 3,
    's2_emb_stride': 2,
    's2_proj_kernel': 3,
    's2_kv_proj_stride': 2,
    's2_heads': 3,
    's2_depth': 2,
    's2_mlp_mult': 4,
    's3_emb_dim': 384,
    's3_emb_kernel': 3,
    's3_emb_stride': 2,
    's3_proj_kernel': 3,
    's3_kv_proj_stride': 2,
    's3_heads': 6,
    's3_depth': 10,
    's3_mlp_mult': 4,
    'dropout': 0.0,
}
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 CvT — 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 CvT 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
CvT Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("6fd86ebfed8c45ff")
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, CvT: 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 flax import linen as nn

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

# Create a minimal input tensor: (batch=2, height=8, width=8, channels=3)
# This represents a small image batch
x = jnp.ones((2, 8, 8, 3))

ARGS = {
    "num_classes": 10,
    "s1_emb_dim": 64,
    "s1_emb_kernel": 7,
    "s1_emb_stride": 4,
    "s1_proj_kernel": 3,
    "s1_kv_proj_stride": 2,
    "s1_heads": 1,
    "s1_depth": 1,
    "s1_mlp_mult": 4,
    "s2_emb_dim": 192,
    "s2_emb_kernel": 3,
    "s2_emb_stride": 2,
    "s2_proj_kernel": 3,
    "s2_kv_proj_stride": 2,
    "s2_heads": 3,
    "s2_depth": 2,
    "s2_mlp_mult": 4,
    "s3_emb_dim": 384,
    "s3_emb_kernel": 3,
    "s3_emb_stride": 2,
    "s3_proj_kernel": 3,
    "s3_kv_proj_stride": 2,
    "s3_heads": 6,
    "s3_depth": 10,
    "s3_mlp_mult": 4,
    "dropout": 0.0,
}
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 CvT — 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 CvT 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
DepthWiseConv2d Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/cvt.py
code served (permissive licence) · get_code("28e2a060ad0a121a")
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, DepthWiseConv2d: 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_in': 3,
    'dim_out': 16,
    'kernel_size': 3,
    'padding': 1,
    'stride': 1,
    'bias': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DepthWiseConv2d — 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 DepthWiseConv2d 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
DepthWiseConv2d Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("d3ffd9a7becc875f")
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, DepthWiseConv2d: 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 a small dummy input tensor for shape inference
# Batch size 2, height 8, width 8, channels 4
dummy_input = jnp.ones((2, 8, 8, 4))

ARGS = {
    'dim_in': 4,
    'dim_out': 8,
    'kernel_size': 3,
    'stride': 1,
    'bias': True,
}
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 DepthWiseConv2d — 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 DepthWiseConv2d 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
DepthWiseConv2d Ran
ran on a synthesized input · constructed an object; no result was computed
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("1900dc0d402d75ab")
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, DepthWiseConv2d: 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_in": 4,
    "dim_out": 8,
    "kernel_size": 3,
    "padding": 1,
    "stride": 1,
    "bias": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DepthWiseConv2d — 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 DepthWiseConv2d 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
ahmedelmahy/myownvit/vit_pytorch/cvt.py
code served (permissive licence) · get_code("4c414437e8099db9")
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,
    "mult": 4,
    "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/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("a4ee1f00f5b87c00")
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 seed for reproducibility
import numpy as np
np.random.seed(0)

# Create a small input tensor for testing
# Shape: (batch, height, width, channels)
batch_size = 2
height = 4
width = 4
dim = 8

x = jnp.ones((batch_size, height, width, dim))

# Initialize the FeedForward module with test parameters
ARGS = {
    "dim": 8,
    "mult": 2,
    "dropout": 0.1,
}

# To actually test this, you would do:
# model = FeedForward(**ARGS)
# key = jax.random.PRNGKey(0)
# params = model.init(key, x)
# output = model.apply(params, x, training=True)
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax, numpy — 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
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("a4becc1ab3fb3cb3")
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)

# FeedForward expects:
# - dim: int (number of channels)
# - act_layer: a callable that returns an activation module
# - mult: int (multiplier for hidden dimension, default=4)

# Looking at the forward method, it applies Conv2d layers to input x
# The input x should be a 4D tensor (batch, channels, height, width)

ARGS = {
    "dim": 4,
    "act_layer": nn.ReLU,
    "mult": 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 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
LayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/cvt.py
code served (permissive licence) · get_code("f919bd05baa8dbfe")
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, LayerNorm: 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)

# The LayerNorm class expects:
# - dim: an integer representing the dimension size
# - eps: a float for numerical stability (optional, has default)

# From the forward method, we can see:
# - x is a 4D tensor (batch, dim, height, width based on parameter shapes)
# - The g and b parameters have shape (1, dim, 1, 1)
# - Operations use dim=1 for variance/mean reduction

ARGS = {
    "dim": 4,
    "eps": 1e-05
}
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 LayerNorm — 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 LayerNorm 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
LayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
conceptofmind/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("9822786697807511")
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, LayerNorm: 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

# Initialize JAX random key for reproducibility
key = jax.random.PRNGKey(0)

# Create a small input tensor with shape (batch=2, height=3, width=3, channels=4)
x = jnp.ones((2, 3, 3, 4), dtype=jnp.float32)

# Define arguments for LayerNorm
ARGS = {
    'dim': 4,
    'eps': 1e-05,
}
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 LayerNorm — 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 LayerNorm 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
ahmedelmahy/myownvit/vit_pytorch/cvt.py
code served (permissive licence) · get_code("ada83fa4cdf0ade2")
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
from torch import nn

torch.manual_seed(0)

class SimpleFunction(nn.Module):
    """Simple stand-in function for PreNorm to call"""
    def __init__(self, dim):
        super().__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x, **kwargs):
        # x shape: (batch, dim, height, width)
        # Reshape for linear layer
        batch, dim, h, w = x.shape
        x_flat = x.view(batch, dim, -1).transpose(1, 2)  # (batch, h*w, dim)
        out = self.linear(x_flat)
        out = out.transpose(1, 2).view(batch, dim, h, w)  # back to (batch, dim, h, w)
        return out

# Create a small function module
dim = 4
fn = SimpleFunction(dim)

# Create input tensor: (batch=2, dim=4, height=3, width=3)
x = torch.randn(2, 4, 3, 3)

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
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("c296102b024e1211")
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
from torch import nn

torch.manual_seed(0)

# Define a simple normalization function (e.g., LayerNorm)
norm = nn.LayerNorm

# Define the dimension
dim = 4

# Define a simple function that takes x and processes it
class SimpleFn(nn.Module):
    def forward(self, x, *args, **kwargs):
        return x * 2

fn = SimpleFn()

ARGS = {
    'norm': norm,
    'dim': dim,
    'fn': fn
}
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 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
ResStem Ran
ran on a synthesized input · constructed an object; no result was computed
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("72cd0feff4d8e28f")
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, ResStem: 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 = {
    'channels_stem': 64,
    'deep': False,
}
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 ResStem — 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 ResStem 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
SepConv2d Ran
ran on a synthesized input
rishikksh20/convolution-vision-transformers/cvt.py
code served (permissive licence) · get_code("9cc172a07a92afb4")
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, 16, 8, 8) 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

INIT_ARGS = {
    'in_channels': 3,
    'out_channels': 16,
    'kernel_size': 3,
    'stride': 1,
    'padding': 1,
    'dilation': 1,
}

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

if __name__ == '__main__':
    model = torch.nn.Module()
    model.__class__ = type('SepConv2d', (torch.nn.Module,), {
        '__init__': lambda self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1: (
            torch.nn.Module.__init__(self),
            setattr(self, 'depthwise', torch.nn.Conv2d(in_channels, in_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=in_channels)),
            setattr(self, 'bn', torch.nn.BatchNorm2d(in_channels)),
            setattr(self, 'pointwise', torch.nn.Conv2d(in_channels, out_channels, kernel_size=1)),
        )[-1],
        'forward': lambda self, x: self.pointwise(self.bn(self.depthwise(x))),
    })
    
    sepconv = type('SepConv2d', (torch.nn.Module,), {
        '__init__': lambda self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1: (
            torch.nn.Module.__init__(self),
            setattr(self, 'depthwise', torch.nn.Conv2d(in_channels, in_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=in_channels)),
            setattr(self, 'bn', torch.nn.BatchNorm2d(in_channels)),
            setattr(self, 'pointwise', torch.nn.Conv2d(in_channels, out_channels, kernel_size=1)),
        )[-1],
        'forward': lambda self, x: self.pointwise(self.bn(self.depthwise(x))),
    })(**INIT_ARGS)
    
    output = sepconv(**ARGS)
    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, 16, 8, 8) — shape (2, 16, 8, 8) 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)
Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
ahmedelmahy/myownvit/vit_pytorch/cvt.py
code served (permissive licence) · get_code("85fb09fd1d03038f")
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
from torch import nn, einsum
from einops import rearrange, repeat

torch.manual_seed(0)

class DepthWiseConv2d(nn.Module):

    def __init__(self, dim_in, dim_out, kernel_size, padding, stride, bias=True):
        super().__init__()
        self.net = nn.Sequential(nn.Conv2d(dim_in, dim_in, kernel_size=kernel_size, padding=padding, groups=dim_in, stride=stride, bias=bias), nn.BatchNorm2d(dim_in), nn.Conv2d(dim_in, dim_out, kernel_size=1, bias=bias))

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

class FeedForward(nn.Module):

    def __init__(self, dim, mult=4, 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)

class LayerNorm(nn.Module):

    def __init__(self, dim, eps=1e-05):
        super().__init__()
        self.eps = eps
        self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
        self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))

    def forward(self, x):
        std = torch.var(x, dim=1, unbiased=False, keepdim=True).sqrt()
        mean = torch.mean(x, dim=1, keepdim=True)
        return (x - mean) / (std + self.eps) * self.g + self.b

class PreNorm(nn.Module):

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

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

class Attention(nn.Module):

    def __init__(self, dim, proj_kernel, kv_proj_stride, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        padding = proj_kernel // 2
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        self.attend = nn.Softmax(dim=-1)
        self.to_q = DepthWiseConv2d(dim, inner_dim, proj_kernel, padding=padding, stride=1, bias=False)
        self.to_kv = DepthWiseConv2d(dim, inner_dim * 2, proj_kernel, padding=padding, stride=kv_proj_stride, bias=False)
        self.to_out = nn.Sequential(nn.Conv2d(inner_dim, dim, 1), nn.Dropout(dropout))

    def forward(self, x):
        shape = x.shape
        b, n, _, y, h = (*shape, self.heads)
        q, k, v = (self.to_q(x), *self.to_kv(x).chunk(2, dim=1))
        q, k, v = map(lambda t: rearrange(t, 'b (h d) x y -> (b h) (x y) d', h=h), (q, k, v))
        dots = einsum('b i d, b j d -> b i j', q, k) * self.scale
        attn = self.attend(dots)
        out = einsum('b i j, b j d -> b i d', attn, v)
        out = rearrange(out, '(b h) (x y) d -> b (h d) x y', h=h, y=y)
        return self.to_out(out)

class Transformer(nn.Module):

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

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

ARGS = {
    "dim": 4,
    "proj_kernel": 3,
    "kv_proj_stride": 1,
    "depth": 2,
    "heads": 2,
    "dim_head": 2,
    "mlp_mult": 4,
    "dropout": 0.0
}
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/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("0a5b9eec36824115")
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
from jax import random

# Initialize a random key for JAX
key = random.PRNGKey(0)

# Create a small input tensor: (batch=2, height=4, width=3, channels=4)
x = jnp.ones((2, 4, 3, 4))

ARGS = {
    "dim": 4,
    "proj_kernel": 3,
    "kv_proj_stride": 1,
    "depth": 2,
    "heads": 2,
    "dim_head": 4,
    "mlp_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
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
rishikksh20/convolution-vision-transformers/cvt.py
code served (permissive licence) · get_code("d6576534c1091ccc")
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; 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
from torch import nn
from einops import rearrange
from torch import einsum

class SepConv2d(torch.nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1):
        super(SepConv2d, self).__init__()
        self.depthwise = torch.nn.Conv2d(in_channels, in_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=in_channels)
        self.bn = torch.nn.BatchNorm2d(in_channels)
        self.pointwise = torch.nn.Conv2d(in_channels, out_channels, kernel_size=1)

    def forward(self, x):
        x = self.depthwise(x)
        x = self.bn(x)
        x = self.pointwise(x)
        return x

class ConvAttention(nn.Module):
    def __init__(self, dim, img_size, heads=8, dim_head=64, kernel_size=3, q_stride=1, k_stride=1, v_stride=1, dropout=0.0, last_stage=False):
        super().__init__()
        self.last_stage = last_stage
        self.img_size = img_size
        inner_dim = dim_head * heads
        project_out = not (heads == 1 and dim_head == dim)
        self.heads = heads
        self.scale = dim_head ** (-0.5)
        pad = (kernel_size - q_stride) // 2
        self.to_q = SepConv2d(dim, inner_dim, kernel_size, q_stride, pad)
        self.to_k = SepConv2d(dim, inner_dim, kernel_size, k_stride, pad)
        self.to_v = SepConv2d(dim, inner_dim, kernel_size, v_stride, pad)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, dim), nn.Dropout(dropout)) if project_out else nn.Identity()

    def forward(self, x):
        b, n, _, h = (*x.shape, self.heads)
        if self.last_stage:
            cls_token = x[:, 0]
            x = x[:, 1:]
            cls_token = rearrange(cls_token.unsqueeze(1), 'b n (h d) -> b h n d', h=h)
        x = rearrange(x, 'b (l w) n -> b n l w', l=self.img_size, w=self.img_size)
        q = self.to_q(x)
        q = rearrange(q, 'b (h d) l w -> b h (l w) d', h=h)
        v = self.to_v(x)
        v = rearrange(v, 'b (h d) l w -> b h (l w) d', h=h)
        k = self.to_k(x)
        k = rearrange(k, 'b (h d) l w -> b h (l w) d', h=h)
        if self.last_stage:
            q = torch.cat((cls_token, q), dim=2)
            v = torch.cat((cls_token, v), dim=2)
            k = torch.cat((cls_token, k), dim=2)
        dots = einsum('b h i d, b h j d -> b h i j', q, k) * self.scale
        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 Transformer(nn.Module):
    def __init__(self, dim, img_size, depth, heads, dim_head, mlp_dim, dropout=0.0, last_stage=False):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([PreNorm(dim, ConvAttention(dim, img_size, heads=heads, dim_head=dim_head, dropout=dropout, last_stage=last_stage)), PreNorm(dim, FeedForward(dim, mlp_dim, dropout=dropout))]))

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

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

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

if __name__ == '__main__':
    model = Transformer(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
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 — 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)
accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
microsoft/CvT/lib/core/evaluate.py
code served (permissive licence) · get_code("48af950e22ac823c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family 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

torch.manual_seed(0)

# The function expects:
# - output: a tensor or list of tensors with shape (batch_size, num_classes)
#   It calls .topk(maxk, 1, True, True) on it
# - target: a tensor of shape (batch_size,) with class indices
# - topk: tuple of integers specifying which k values to compute accuracy for

batch_size = 2
num_classes = 4

# Create output logits tensor (batch_size x num_classes)
output = torch.randn(batch_size, num_classes)

# Create target tensor with valid class indices (0 to num_classes-1)
target = torch.tensor([1, 2])

# Define topk parameter
topk = (1, 2)

ARGS = {
    "output": output,
    "target": target,
    "topk": topk,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — 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
all_gather Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/utils/comm.py
code served (permissive licence) · get_code("dbb4a0fbb6f9600c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type 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 pickle
import torch
import torch.distributed as dist

torch.manual_seed(0)

# The function all_gather takes one parameter: data
# Looking at the function body, it:
# - Pickles the data
# - Works with arbitrary picklable objects
# - In the non-distributed case (world_size == 1), just returns [data]
# 
# Since we're not in a distributed setting (dist.is_initialized() will be False),
# the function will return [data] immediately, so data can be any picklable object

# Let's use a simple dictionary as the data
data = {
    "key1": "value1",
    "key2": 42,
    "tensor": torch.randn(2, 4),
    "list": [1, 2, 3]
}

ARGS = {
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — 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
build_criterion Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/core/loss.py
code served (permissive licence) · get_code("79e00b7e79094bff")
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 LabelSmoothingCrossEntropy. 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 Config:
    def __init__(self):
        self.AUG = type('obj', (object,), {'MIXUP_PROB': 0.0})()
        self.LOSS = type('obj', (object,), {
            'LOSS': 'softmax',
            'LABEL_SMOOTHING': 0.1
        })()

config = Config()

ARGS = {
    'config': config,
    'train': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LabelSmoothingCrossEntropy — a LabelSmoothingCrossEntropy output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LabelSmoothingCrossEntropy 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
build_model Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/models/build.py
code served (permissive licence) · get_code("0f4931981bc034df")
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 DummyModel. 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 unittest.mock import MagicMock

torch.manual_seed(0)

# Build a minimal config class that has MODEL.NAME attribute
class ModelConfig:
    def __init__(self):
        self.MODEL = MagicMock()
        self.MODEL.NAME = "test_model"

# Create a minimal model entrypoint function that returns a simple nn.Module
def dummy_model_builder(config, **kwargs):
    class DummyModel(nn.Module):
        def __init__(self):
            super().__init__()
            self.linear = nn.Linear(4, 3)
        
        def forward(self, x):
            return self.linear(x)
    
    return DummyModel()

# Mock the is_model and model_entrypoints functions
def is_model(name):
    return name == "test_model"

def model_entrypoints(name):
    if name == "test_model":
        return dummy_model_builder
    return None

# Inject mocks into the namespace where build_model will look for them
import sys
current_module = sys.modules[__name__]
setattr(current_module, 'is_model', is_model)
setattr(current_module, 'model_entrypoints', model_entrypoints)

# Create the build_model function with access to mocked functions
def build_model(config, **kwargs):
    model_name = config.MODEL.NAME
    if not is_model(model_name):
        raise ValueError(f'Unkown model: {model_name}')
    return model_entrypoints(model_name)(config, **kwargs)

# Build the arguments
config = ModelConfig()

ARGS = {
    'config': config,
}
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 DummyModel — a DummyModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DummyModel 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
build_optimizer Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/optim/build.py
code served (permissive licence) · get_code("cafe3a0bb0d90db6")
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 AdamW. 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
import torch.optim as optim

torch.manual_seed(0)

# Create a minimal config object with all required attributes
class Config:
    class TRAIN:
        OPTIMIZER = 'adamW'
        LR = 0.001
        MOMENTUM = 0.9
        WD = 0.0001
        NESTEROV = True
        RMSPROP_ALPHA = 0.99
        RMSPROP_CENTERED = False
        WITHOUT_WD_LIST = ['dw', 'bn', 'bias']
        OPTIMIZER_ARGS = None
    
    VERBOSE = False

# Create a minimal model with depthwise convs, batch norm, and regular layers
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Regular conv layer
        self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
        # Depthwise conv layer (groups == in_channels == out_channels)
        self.dw_conv = nn.Conv2d(16, 16, kernel_size=3, padding=1, groups=16)
        # Batch norm
        self.bn1 = nn.BatchNorm2d(16)
        # Linear layer with bias
        self.fc = nn.Linear(16, 10)
    
    def forward(self, x):
        x = self.conv1(x)
        x = self.dw_conv(x)
        x = self.bn1(x)
        return x

cfg = Config()
model = MinimalModel()

ARGS = {
    'cfg': cfg,
    'model': model
}
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 AdamW — a AdamW output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AdamW 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
count_parameters Ran
ran, honoured the contract we drafted
microsoft/CvT/lib/utils/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from wer010/Couplformer, is pointer only (licence: NONE) · get_code("6a41f5e3194a54b1")
How it ran

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

group_by_key_prefix_and_remove_prefix Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from ml4sci/deeplense
pointer only; the stored copy get_code serves, from ml4sci/deeplense, is pointer only (licence: NONE) · get_code("ca4faa49da53bd5c")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

group_dict_by_key Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from ml4sci/deeplense
pointer only; the stored copy get_code serves, from ml4sci/deeplense, is pointer only (licence: NONE) · get_code("afcf8f2954675d55")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

is_model Ran
ran, violated the contract we drafted
microsoft/CvT/lib/models/registry.py
pointer only (licence: MIT); the stored copy get_code serves, from ux-decoder/dinov, is pointer only (licence: NONE) · get_code("86c6e09f9f6f6637")
How it ran

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

linear_combination Ran
ran, honoured the contract we drafted
leoxiaobin/CvT/lib/core/loss.py
pointer only (licence: MIT); the stored copy get_code serves, from tmlr-group/atol, is pointer only (licence: NONE) · get_code("ee5e85cfd16bc5dc")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, leoxiaobin/CvT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

norm_cdf Ran
ran, honoured the contract we drafted
EMalagoli92/CvT-TensorFlow/cvt_tensorflow/models/layers/utils.py
code served (permissive licence) · get_code("1e7a21b70e475e05")
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 math

def norm_cdf(x):
    """Computes standard normal cumulative distribution."""
    return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0

# The function takes a single parameter x and applies math operations to it
# x can be a float, int, or any numeric type that supports division and math.erf

ARGS = {
    "x": 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
reduce_dict Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/utils/comm.py
code served (permissive licence) · get_code("19a8d1208f8a920f")
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 dict. 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.distributed as dist

torch.manual_seed(0)

# Create a simple input dictionary with tensor values
input_dict = {
    'loss': torch.tensor(1.5),
    'accuracy': torch.tensor(0.95),
    'metric_a': torch.tensor(2.3),
}

ARGS = {
    'input_dict': input_dict,
    'average': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
reduce_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
leoxiaobin/CvT/lib/core/loss.py
pointer only (licence: MIT); the stored copy get_code serves, from tmlr-group/atol, is pointer only (licence: NONE) · get_code("9f7b947fbfdaa657")
How it ran

The body of this sample is withheld: MIT, as GitHub detects it on this paper's repository, leoxiaobin/CvT, is in the permissive set, but a licence decision keeps the body a pointer: the reason for that decision is not recorded with it. 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.

register_model Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/models/registry.py
pointer only (licence: MIT); the stored copy get_code serves, from ux-decoder/dinov, is pointer only (licence: NONE) · get_code("be2fbb8bf98a15f7")
How it ran

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

run_layers_list Ran
ran on a synthesized input
EMalagoli92/CvT-TensorFlow/cvt_tensorflow/models/utils.py
code served (permissive licence) · get_code("8db082cfc9d2e2cf")
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 EagerTensor, ndim 2, dtype family float, shape (2, 2) 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 tensorflow as tf

# Create a small input tensor (batch_size=2, features=4)
input_tensor = tf.constant([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]])

# Create a list of keras layers
layers_list = [
    tf.keras.layers.Dense(3, activation='relu'),
    tf.keras.layers.Dense(5, activation='relu'),
    tf.keras.layers.Dense(2)
]

ARGS = {
    'input_': input_tensor,
    'list_': layers_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
set_wd Ran
ran; our contract draft was wrong, not the code
microsoft/CvT/lib/optim/build.py
code served (permissive licence) · get_code("210dd79dd3fdc950")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family 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 torch.nn as nn

torch.manual_seed(0)

# Build a minimal config object with required attributes
class Config:
    def __init__(self):
        self.TRAIN = TrainConfig()
        self.VERBOSE = True

class TrainConfig:
    def __init__(self):
        self.WITHOUT_WD_LIST = ['dw', 'bn', 'gn', 'ln', 'bias']

# Build a minimal model with various layer types
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Regular conv layer
        self.conv1 = nn.Conv2d(3, 16, kernel_size=3, padding=1)
        # Depthwise conv layer
        self.dw_conv = nn.Conv2d(16, 16, kernel_size=3, padding=1, groups=16)
        # BatchNorm2d
        self.bn = nn.BatchNorm2d(16)
        # GroupNorm
        self.gn = nn.GroupNorm(4, 16)
        # LayerNorm
        self.ln = nn.LayerNorm(16)
        # Regular layer with bias
        self.linear = nn.Linear(16, 8)
    
    def forward(self, x):
        return x

cfg = Config()
model = MinimalModel()

ARGS = {
    'cfg': cfg,
    'model': model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — 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
trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
EMalagoli92/CvT-TensorFlow/cvt_tensorflow/models/layers/utils.py
code served (permissive licence) · get_code("1ad1d109f5a6e55b")
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 EagerTensor, ndim 2, dtype family float, shape (2, 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 tensorflow as tf
import math

ARGS = {
    'shape': (2, 4),
    'mean': 0.0,
    'std': 1.0,
    'a': -2.0,
    'b': 2.0,
    'dtype': tf.float32
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CvT Not yet run
unverified (harvested, no recorded run)
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("addb189889d498a2")
How it ran

no invocation recorded.

CvT Not yet run
unverified (harvested, no recorded run)
rishikksh20/convolution-vision-transformers/cvt.py
code served (permissive licence) · get_code("9d4228c318890e3e")
How it ran

no invocation recorded.

GlobalAvgPool Not yet run
unverified (harvested, no recorded run)
conceptofmind/CvT-flax/cvt_flax/cvt_flax.py
code served (permissive licence) · get_code("36c58f137e9289c0")
How it ran

no invocation recorded.

Transformer Not yet run
unverified (harvested, no recorded run)
microsoft/esvit/models/cvt_v4_transformer.py
code served (permissive licence) · get_code("00dced1853563caf")
How it ran

no invocation recorded.

build_dataloader Not yet run
unverified (harvested, no recorded run)
microsoft/CvT/lib/dataset/build.py
code served (permissive licence) · get_code("51dc0ff05a226bd7")
How it ran

no invocation recorded.

build_dataset Not yet run
unverified (harvested, no recorded run)
microsoft/CvT/lib/dataset/build.py
code served (permissive licence) · get_code("d664b0a074d4c567")
How it ran

no invocation recorded.

build_lr_scheduler Not yet run
unverified (harvested, no recorded run)
microsoft/CvT/lib/scheduler/build.py
code served (permissive licence) · get_code("60eb73feb15fe78a")
How it ran

no invocation recorded.

model_entrypoints Not yet run
unverified (harvested, no recorded run)
microsoft/CvT/lib/models/registry.py
pointer only (licence: MIT); the stored copy get_code serves, from ux-decoder/dinov, is pointer only (licence: NONE) · get_code("0c3902b80e9968b5")
How it ran

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

Also present in other papers' code

Of 47 samples lifted from this paper's linked repositories, 47 carry a function identity and 0 do not. Of the 47 distinct functions with an identity, 12 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 12 later) and 35 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
is_model 22 other papers
4 dated earlier, 18 later
1409.4842 (2014-09)
Going deeper with convolutions
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
1608.06993 (2016-08)
Densely Connected Convolutional Networks
and 19 more not named here
LayerNorm
brick of this paper's assembly: helper
3 other papers
1 dated earlier, 2 later · 2 only as an assembly brick
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2105.15203 (2021-05)
SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
2601.18260 (2026-01)
Depth to Anatomy: Organ Localization from Depth Images for Automated Patient Table Positioning in Radiology Workflow
count_parameters 3 other papers
3 later
2112.05425 (2021-12)
Couplformer:Rethinking Vision Transformer with Coupling Attention Map
2403.19067 (2024-03)
Low-Rank Rescaled Vision Transformer Fine-Tuning: A Residual Design Approach
group_by_key_prefix_and_remove_prefix
brick of this paper's assembly: helper
3 other papers
3 later
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2110.03414 (2021-10)
SERAB: A multi-lingual benchmark for speech emotion recognition
2112.12121 (2021-12)
Domain Adaptation for Simulation-Based Dark Matter Searches Using Strong Gravitational Lensing
group_dict_by_key
brick of this paper's assembly: helper
3 other papers
3 later
2106.03746 (2021-06)
Efficient Training of Visual Transformers with Small Datasets
2110.03414 (2021-10)
SERAB: A multi-lingual benchmark for speech emotion recognition
2112.12121 (2021-12)
Domain Adaptation for Simulation-Based Dark Matter Searches Using Strong Gravitational Lensing
linear_combination 3 other papers
3 later
2208.13196 (2022-08)
Grounded Affordance from Exocentric View
2210.11065 (2022-10)
MovieCLIP: Visual Scene Recognition in Movies
2311.03236 (2023-11)
Out-of-distribution Detection Learning with Unreliable Out-of-distribution Sources
norm_cdf 3 other papers
1 dated earlier, 2 later
1907.04433 (2019-07)
GluonCV and GluonNLP: Deep Learning in Computer Vision and Natural Language Processing
2202.09741 (2022-02)
Visual Attention Network
2206.09959 (2022-06)
Global Context Vision Transformers
reduce_loss 3 other papers
3 later
2208.13196 (2022-08)
Grounded Affordance from Exocentric View
2210.11065 (2022-10)
MovieCLIP: Visual Scene Recognition in Movies
2311.03236 (2023-11)
Out-of-distribution Detection Learning with Unreliable Out-of-distribution Sources
model_entrypoints 2 other papers
2 later
2306.09347 (2023-06)
Segment Any Point Cloud Sequences by Distilling Vision Foundation Models
2311.13601 (2023-11)
Visual In-Context Prompting
register_model 2 other papers
2 later
2306.09347 (2023-06)
Segment Any Point Cloud Sequences by Distilling Vision Foundation Models
2311.13601 (2023-11)
Visual In-Context Prompting
trunc_normal_ 2 other papers
2 later
2202.09741 (2022-02)
Visual Attention Network
2206.09959 (2022-06)
Global Context Vision Transformers
GlobalAvgPool
brick of this paper's assembly: helper
1 other paper
1 later
2104.01136 (2021-04)
LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference

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

We present in this paper a new architecture, named Convolutional vision Transformer (CvT), that improves Vision Transformer (ViT) in performance and efficiency by introducing convolutions into ViT to yield the best of both designs. This is accomplished through two primary modifications: a hierarchy of Transformers containing a new convolutional token embedding, and a convolutional Transformer block leveraging a convolutional projection. These changes introduce desirable properties of convolutional neural networks (CNNs) to the ViT architecture (i.e. shift, scale, and distortion invariance) while maintaining the merits of Transformers (i.e. dynamic attention, global context, and better generalization). We validate CvT by conducting extensive experiments, showing that this approach achieves state-of-the-art performance over other Vision Transformers and ResNets on ImageNet-1k, with fewer parameters and lower FLOPs. In addition, performance gains are maintained when pretrained on larger datasets (e.g. ImageNet-22k) and fine-tuned to downstream tasks. Pretrained on ImageNet-22k, our CvT-W24 obtains a top-1 accuracy of 87.7% on the ImageNet-1k val set. Finally, our results show that the positional encoding, a crucial component in existing Vision Transformers, can be safely removed in our model, simplifying the design for higher resolution vision tasks. Code will be released at https: //github.com/microsoft/CvT.

For agents

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

get_harvested_code_for_paper("2103.15808")
get_code_for_paper("2103.15808")
have("2103.15808")

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

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

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

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

Connect an agent — have() is free.