SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.02178 · ICLR · 2022

MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer

Mohammad Rastegari, Sachin Mehta

arXiv · PDF · Open in the Atlas

Code that ran

53 of 68 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (31 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 43 have no contract verdict; 9 failures of our instrument; 15 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/2110.02178.json · badge: /api/ran/2110.02178.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
chinhsuanwu/mobilevit-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
7 ran · 3 no recorded run
kornia/kornia community
Papers with Code archive
7 ran · 2 no recorded run
xmu-xiaoma666/External-Attention-pytorch community
Papers with Code archive
7 ran · 1 no recorded run
wilile26811249/MobileViT reimplementation (classifier label)
classifier basis: classifier_2025
6 ran · 4 no recorded run
murufeng/awesome_lightweight_networks community
Papers with Code archive
6 ran · 1 no recorded run
mmaaz60/EdgeNeXt community
Papers with Code archive
5 ran · 1 no recorded run
roydenwa/cell-centroid-former community
Papers with Code archive
5 ran · 0 no recorded run
godhj93/MobileViT community
Papers with Code archive
4 ran · 2 no recorded run
jaiwei98/mobile-vit-pytorch community
Papers with Code archive
4 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
jaiwei98/mobile-vit-pytorch/mobile_vit/mobilevit.py
pointer only (licence: NONE) · get_code("7dce48772b2e159a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jaiwei98/mobile-vit-pytorch 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.

Attention Ran
ran on a synthesized input
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("43531c7c47f675ef")
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, 3, 4, 16) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from einops import rearrange

class Attention(nn.Module):

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

    def forward(self, x):
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b p n (h d) -> b p h n d', h=self.heads), qkv)
        dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale
        attn = self.attend(dots)
        out = torch.matmul(attn, v)
        out = rearrange(out, 'b p h n d -> b p n (h d)')
        return self.to_out(out)


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

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

if __name__ == '__main__':
    attention = Attention(**INIT_ARGS)
    output = attention(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print("Success!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 4, 16) — shape (2, 3, 4, 16) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("d55210e5cfb23cea")
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
from einops import rearrange

torch.manual_seed(0)

class Attention(nn.Module):

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

    def forward(self, x):
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b p n (h d) -> b p h n d', h=self.heads), qkv)
        dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale
        attn = self.attend(dots)
        out = torch.matmul(attn, v)
        out = rearrange(out, 'b p h n d -> b p n (h d)')
        return self.to_out(out)


# Create input tensor: shape (batch=2, p=3, n=4, dim=4)
x = torch.randn(2, 3, 4, 4)

ARGS = {
    "dim": 4,
    "heads": 2,
    "head_dim": 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
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("2230f658d6c25822")
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, 3, 5, 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
from torch import nn

class Attention(nn.Module):
    """Implement the Multi-Head Attention module.

    Args:
        dim: The input dimension size.
        heads: The number of attention heads. Default: 8.
        dim_head: The dimension of each head. Default: 64.
        dropout: The dropout probability. Default: 0.0.
    """

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

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        """Apply multi-head self-attention to MobileViT tokens.

        Args:
            x: Token tensor with shape :math:`(B, P, N, D)`, where
                :math:`B` is batch size, :math:`P` is patch area,
                :math:`N` is number of patches, and :math:`D` is embedding
                dimension.

        Returns:
            Tensor with the same shape as ``x`` after attention and output
            projection.
        """
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        b, p, n, hd = qkv[0].shape
        q, k, v = (t.reshape(b, p, n, self.heads, hd // self.heads).transpose(2, 3) for t in qkv)
        dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale
        attn = self.attend(dots)
        out = torch.matmul(attn, v)
        out = out.transpose(2, 3).reshape(b, p, n, hd)
        return self.to_out(out)


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

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

if __name__ == '__main__':
    attention = Attention(**INIT_ARGS)
    output = attention(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print("Success!")
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, 3, 5, 8) — shape (2, 3, 5, 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)
ChannelMLP Ran
ran on a synthesized input · constructed an object; no result was computed
roydenwa/cell-centroid-former/src/cellcentroidformer/model_architecture.py
pointer only (licence: NONE) · get_code("f1f1c5ff227fe41d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, roydenwa/cell-centroid-former 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.

ConvEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
mmaaz60/EdgeNeXt/models/edgenext.py
code served (permissive licence) · get_code("a75100d19286cb15")
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, ConvEncoder: 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
import torch.nn.functional as F
from timm.models.layers import DropPath

torch.manual_seed(0)

ARGS = {
    'dim': 4,
    'drop_path': 0.1,
    'layer_scale_init_value': 1e-06,
    'expan_ratio': 4,
    'kernel_size': 7,
}
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 ConvEncoder — 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 ConvEncoder 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
ConvNormAct Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("8ed7073f6f37a1a1")
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, ConvNormAct: 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 = {
    'in_channels': 3,
    'out_channels': 16,
    'kernel_size': 3,
    'stride': 1,
    'padding': None,
    'groups': 1,
    'norm_layer': nn.BatchNorm2d,
    'activation_layer': nn.SiLU,
    'dilation': 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 ConvNormAct — 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 ConvNormAct 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
Conv_BN_ReLU Ran
ran; our contract draft was wrong, not the code
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("38ab7af20618ac3e")
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 Sequential. 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 = {
    'inp': 3,
    'oup': 16,
    'kernel': 3,
    'stride': 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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
EncoderLayer Ran
ran on a synthesized input · constructed an object; no result was computed
godhj93/MobileViT/utils/nets/MobileViT.py
pointer only (licence: NONE) · get_code("20ec52f2f7242b3d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, godhj93/MobileViT 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.

FFN Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("0700a6a34626a6bf")
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, FFN: 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,
    "hidden_dim": 8,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FFN — 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 FFN 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
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("4d1e816536427160")
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.__init__ takes: self, dim, hidden_dim, dropout=0.0
# FeedForward.forward takes: self, x (a tensor)

# Create a small input tensor to understand expected shapes
# dim: feature dimension (use 4)
# hidden_dim: hidden layer dimension (use 8, distinct from dim)
# dropout: dropout rate (use 0.1)

dim = 4
hidden_dim = 8
dropout = 0.1

# Create sample input: (batch_size, dim)
# batch_size = 2, dim = 4
x = torch.randn(2, 4)

ARGS = {
    "dim": dim,
    "hidden_dim": hidden_dim,
    "dropout": dropout,
}
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
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("878fe3f52adf2d34")
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,
    "mlp_dim": 8,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("58080bbc3d99ba0f")
How it ran

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

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.SiLU(), nn.Dropout(dropout), nn.Linear(hidden_dim, dim), nn.Dropout(dropout))

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


INIT_ARGS = {
    'dim': 4,
    'hidden_dim': 8,
    'dropout': 0.1,
}

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

if __name__ == '__main__':
    model = FeedForward(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
FeedForward Ran
ran on a synthesized input
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("144b7a438af242ef")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

class FeedForward(nn.Module):
    """Implement the Feed-Forward network block for Vision Transformers.

    Args:
        dim: The input dimension size.
        hidden_dim: The dimension of the hidden layer.
        dropout: The dropout probability. Default: 0.0.
    """

    def __init__(self, dim: int, hidden_dim: int, dropout: float=0.0) -> None:
        super().__init__()
        self.net = nn.Sequential(nn.Linear(dim, hidden_dim), nn.SiLU(), nn.Dropout(dropout), nn.Linear(hidden_dim, dim), nn.Dropout(dropout))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        """Apply the feed-forward projection to token features.

        Args:
            x: Token tensor with last dimension equal to ``dim``.

        Returns:
            Tensor with the same shape as ``x`` after two linear projections,
            activation, and dropout.
        """
        return self.net(x)


INIT_ARGS = {
    "dim": 4,
    "hidden_dim": 8,
    "dropout": 0.1,
}

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

if __name__ == "__main__":
    model = FeedForward(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Output:\n{output}")
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
InvertedResidual Ran
ran on a synthesized input · constructed an object; no result was computed
jaiwei98/mobile-vit-pytorch/mobile_vit/mobilevit.py
pointer only (licence: NONE) · get_code("c56c074407924b8b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jaiwei98/mobile-vit-pytorch 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.

InvertedResidual Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("cc6fad7bef0b8c04")
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, InvertedResidual: 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 = {
    "in_channels": 3,
    "out_channels": 16,
    "stride": 1,
    "expand_ratio": 2,
    "act_layer": nn.SiLU,
}
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 InvertedResidual — 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 InvertedResidual 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
mmaaz60/EdgeNeXt/models/edgenext.py
code served (permissive licence) · get_code("d59faa990dd0baa0")
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)

# For channels_last format, we need a tensor of shape (batch, seq_len, channels)
# For channels_first format, we need a tensor of shape (batch, channels, height, width)

# Test with channels_last
x_channels_last = torch.randn(2, 5, 4)  # batch=2, seq_len=5, channels=4

# Test with channels_first
x_channels_first = torch.randn(2, 4, 3, 3)  # batch=2, channels=4, height=3, width=3

ARGS = {
    'normalized_shape': 4,
    'eps': 1e-06,
    'data_format': 'channels_last'
}
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
MV2Block Ran
ran on a synthesized input · constructed an object; no result was computed
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("e789209b847f99a6")
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, MV2Block: 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)

# MV2Block is a nn.Module that expects:
# - inp: input channels (int)
# - oup: output channels (int)
# - stride: stride for convolution (int, default 1)
# - expand_ratio: expansion ratio (int, default 4)

# Create a small instance with distinct channel dimensions
inp_channels = 4
oup_channels = 3
stride = 1
expand_ratio = 4

ARGS = {
    'inp': inp_channels,
    'oup': oup_channels,
    'stride': stride,
    'expand_ratio': expand_ratio
}
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 MV2Block — 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 MV2Block 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
MV2Block Ran
ran on a synthesized input · constructed an object; no result was computed
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("7a5ed61c85d652d3")
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, MV2Block: 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 = {
    "inp": 4,
    "out": 8,
    "stride": 1,
    "expansion": 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 MV2Block — 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 MV2Block 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
MV2Block Ran
ran on a synthesized input
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("d8b589747023f0ed")
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, 8, 16, 16) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

class MV2Block(nn.Module):

    def __init__(self, inp, oup, stride=1, expansion=4):
        super().__init__()
        self.stride = stride
        assert stride in [1, 2]
        hidden_dim = int(inp * expansion)
        self.use_res_connect = self.stride == 1 and inp == oup
        if expansion == 1:
            self.conv = nn.Sequential(nn.Conv2d(hidden_dim, hidden_dim, 3, stride, 1, groups=hidden_dim, bias=False), nn.BatchNorm2d(hidden_dim), nn.SiLU(), nn.Conv2d(hidden_dim, oup, 1, 1, 0, bias=False), nn.BatchNorm2d(oup))
        else:
            self.conv = nn.Sequential(nn.Conv2d(inp, hidden_dim, 1, 1, 0, bias=False), nn.BatchNorm2d(hidden_dim), nn.SiLU(), nn.Conv2d(hidden_dim, hidden_dim, 3, stride, 1, groups=hidden_dim, bias=False), nn.BatchNorm2d(hidden_dim), nn.SiLU(), nn.Conv2d(hidden_dim, oup, 1, 1, 0, bias=False), nn.BatchNorm2d(oup))

    def forward(self, x):
        if self.use_res_connect:
            return x + self.conv(x)
        else:
            return self.conv(x)


INIT_ARGS = {
    'inp': 8,
    'oup': 8,
    'stride': 1,
    'expansion': 4,
}

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

if __name__ == '__main__':
    block = MV2Block(**INIT_ARGS)
    block.eval()
    output = block(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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, 8, 16, 16) — shape (2, 8, 16, 16) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MV2Block Ran
ran on a synthesized input
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("ed0efa372d4badcc")
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, 8, 3, 3) 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 MV2Block(nn.Module):
    """MV2 block described in MobileNetV2.

    Paper: https://arxiv.org/pdf/1801.04381
    Based on: https://github.com/tonylins/pytorch-mobilenet-v2

    Args:
        inp: input channel.
        oup: output channel.
        stride: stride for convolution, defaults to 1, set to 2 if down-sample.
        expansion: expansion ratio for hidden dimension, defaults to 4.

    """

    def __init__(self, inp: int, oup: int, stride: int=1, expansion: int=4) -> None:
        super().__init__()
        self.stride = stride
        hidden_dim = int(inp * expansion)
        self.use_res_connect = self.stride == 1 and inp == oup
        if expansion == 1:
            self.conv = nn.Sequential(nn.Conv2d(hidden_dim, hidden_dim, 3, stride, 1, groups=hidden_dim, bias=False), nn.BatchNorm2d(hidden_dim), nn.SiLU(), nn.Conv2d(hidden_dim, oup, 1, 1, 0, bias=False), nn.BatchNorm2d(oup))
        else:
            self.conv = nn.Sequential(nn.Conv2d(inp, hidden_dim, 1, 1, 0, bias=False), nn.BatchNorm2d(hidden_dim), nn.SiLU(), nn.Conv2d(hidden_dim, hidden_dim, 3, stride, 1, groups=hidden_dim, bias=False), nn.BatchNorm2d(hidden_dim), nn.SiLU(), nn.Conv2d(hidden_dim, oup, 1, 1, 0, bias=False), nn.BatchNorm2d(oup))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        """Apply an inverted residual MobileNetV2 block.

        Args:
            x: Feature map tensor with shape :math:`(B, C_{in}, H, W)`.

        Returns:
            Feature map tensor with output channels ``oup``. When stride is one
            and input/output channels match, the block adds the residual input.
        """
        if self.use_res_connect:
            return x + self.conv(x)
        else:
            return self.conv(x)


INIT_ARGS = {
    "inp": 4,
    "oup": 8,
    "stride": 1,
    "expansion": 2,
}

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

if __name__ == "__main__":
    block = MV2Block(**INIT_ARGS)
    block.eval()
    output = block(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {output}")
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, 8, 3, 3) — shape (2, 8, 3, 3) 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)
MViT_block Ran
ran on a synthesized input · constructed an object; no result was computed
godhj93/MobileViT/utils/nets/MobileViT.py
pointer only (licence: NONE) · get_code("0d8adae319bee6c7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, godhj93/MobileViT 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.

MobileViTAttention Ran
ran on a synthesized input · constructed an object; no result was computed
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("315d52a69ddead31")
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, MobileViTAttention: 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)

# MobileViTAttention expects:
# - in_channel: int (number of input channels)
# - dim: int (transformer dimension)
# - kernel_size: int (convolution kernel size)
# - patch_size: int (patch size for rearrangement)
# - depth: int (transformer depth)
# - mlp_dim: int (MLP dimension in transformer)

# All parameters are ints, so we just need to provide valid integer values
# that work with the forward pass dimensions

ARGS = {
    'in_channel': 3,
    'dim': 8,
    'kernel_size': 3,
    'patch_size': 2,
    'depth': 1,
    'mlp_dim': 16
}
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 MobileViTAttention — 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 MobileViTAttention 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
MobileViTBlock Ran
ran on a synthesized input · constructed an object; no result was computed
jaiwei98/mobile-vit-pytorch/mobile_vit/mobilevit.py
pointer only (licence: NONE) · get_code("51b0a869e04e4c79")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jaiwei98/mobile-vit-pytorch 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.

MobileViTBlock Ran
ran on a synthesized input · constructed an object; no result was computed
roydenwa/cell-centroid-former/src/cellcentroidformer/model_architecture.py
pointer only (licence: NONE) · get_code("6f15cb3df6e1d23e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, roydenwa/cell-centroid-former 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.

MobileViTBlock Ran
ran on a synthesized input · constructed an object; no result was computed
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("69a7b757b4410e76")
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, MobileViTBlock: 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

torch.manual_seed(0)

ARGS = {
    "dim": 64,
    "depth": 2,
    "channel": 32,
    "kernel_size": 3,
    "patch_size": (2, 2),
    "mlp_dim": 128,
    "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 MobileViTBlock — 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 MobileViTBlock 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
MobileViTBlock Ran
ran on a synthesized input
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("8eca4842b31caba0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from einops import rearrange

# Import all classes from the provided code
import torch
import torch.nn as nn
from einops import rearrange

class Attention(nn.Module):

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

    def forward(self, x):
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b p n (h d) -> b p h n d', h=self.heads), qkv)
        dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale
        attn = self.attend(dots)
        out = torch.matmul(attn, v)
        out = rearrange(out, 'b p h n d -> b p n (h d)')
        return self.to_out(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.SiLU(), 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, depth, heads, dim_head, mlp_dim, dropout=0.0):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([PreNorm(dim, Attention(dim, heads, dim_head, dropout)), PreNorm(dim, FeedForward(dim, mlp_dim, dropout))]))

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

def conv_1x1_bn(inp, oup):
    return nn.Sequential(nn.Conv2d(inp, oup, 1, 1, 0, bias=False), nn.BatchNorm2d(oup), nn.SiLU())

def conv_nxn_bn(inp, oup, kernal_size=3, stride=1):
    return nn.Sequential(nn.Conv2d(inp, oup, kernal_size, stride, 1, bias=False), nn.BatchNorm2d(oup), nn.SiLU())

class MobileViTBlock(nn.Module):

    def __init__(self, dim, depth, channel, kernel_size, patch_size, mlp_dim, dropout=0.0):
        super().__init__()
        self.ph, self.pw = patch_size
        self.conv1 = conv_nxn_bn(channel, channel, kernel_size)
        self.conv2 = conv_1x1_bn(channel, dim)
        self.transformer = Transformer(dim, depth, 4, 8, mlp_dim, dropout)
        self.conv3 = conv_1x1_bn(dim, channel)
        self.conv4 = conv_nxn_bn(2 * channel, channel, kernel_size)

    def forward(self, x):
        y = x.clone()
        x = self.conv1(x)
        x = self.conv2(x)
        _, _, h, w = x.shape
        x = rearrange(x, 'b d (h ph) (w pw) -> b (ph pw) (h w) d', ph=self.ph, pw=self.pw)
        x = self.transformer(x)
        x = rearrange(x, 'b (ph pw) (h w) d -> b d (h ph) (w pw)', h=h // self.ph, w=w // self.pw, ph=self.ph, pw=self.pw)
        x = self.conv3(x)
        x = torch.cat((x, y), 1)
        x = self.conv4(x)
        return x


INIT_ARGS = {
    'dim': 32,
    'depth': 2,
    'channel': 16,
    'kernel_size': 3,
    'patch_size': (2, 2),
    'mlp_dim': 64,
    'dropout': 0.0
}

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

if __name__ == '__main__':
    model = MobileViTBlock(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 16, 8, 8)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MobileVitBlock Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("355dd4ca53ea56d8")
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, MobileVitBlock: 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 = {
    "in_channels": 3,
    "out_channels": 16,
    "d_model": 32,
    "layers": 2,
    "mlp_dim": 64,
}
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 MobileVitBlock — 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 MobileVitBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MultiHeadSelfAttention Ran
ran on a synthesized input
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("3b57311302acf06c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from einops import rearrange

class MultiHeadSelfAttention(nn.Module):
    """
    Implement multi head self attention layer using the "Einstein summation convention".
    Paper: https://arxiv.org/abs/1706.03762
    Blog: https://towardsdatascience.com/illustrated-self-attention-2d627e33b20a
    Parameters
    ----------
    dim:
        Token's dimension, EX: word embedding vector size
    num_heads:
        The number of distinct representations to learn
    dim_head:
        The dimension of the each head
    """

    def __init__(self, dim, num_heads=8, dim_head=None):
        super(MultiHeadSelfAttention, self).__init__()
        self.num_heads = num_heads
        self.dim_head = int(dim / num_heads) if dim_head is None else dim_head
        _weight_dim = self.num_heads * self.dim_head
        self.to_qvk = nn.Linear(dim, _weight_dim * 3, bias=False)
        self.scale_factor = dim ** (-0.5)
        self.scale_factor = dim ** (-0.5)
        self.w_out = nn.Linear(_weight_dim, dim, bias=False)

    def forward(self, x):
        qkv = self.to_qvk(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b p n (h d) -> b p h n d', h=self.num_heads), qkv)
        dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale_factor
        attn = torch.softmax(dots, dim=-1)
        out = torch.matmul(attn, v)
        out = rearrange(out, 'b p h n d -> b p n (h d)')
        return self.w_out(out)


INIT_ARGS = {
    'dim': 8,
    'num_heads': 2,
    'dim_head': None,
}

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

if __name__ == '__main__':
    model = MultiHeadSelfAttention(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, f"Shape mismatch: {output.shape} vs {ARGS['x'].shape}"
    print("Test passed!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MultiLayerPerceptron Ran
ran on a synthesized input · constructed an object; no result was computed
roydenwa/cell-centroid-former/src/cellcentroidformer/model_architecture.py
pointer only (licence: NONE) · get_code("c6e2b5d57c742ded")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, roydenwa/cell-centroid-former 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.

PositionalEncodingFourier Ran
ran on a synthesized input · constructed an object; no result was computed
mmaaz60/EdgeNeXt/models/edgenext.py
code served (permissive licence) · get_code("9917b766bd4dba3a")
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, PositionalEncodingFourier: 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
import math

torch.manual_seed(0)

ARGS = {
    "hidden_dim": 32,
    "dim": 768,
    "temperature": 10000,
}
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 PositionalEncodingFourier — 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 PositionalEncodingFourier 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
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("bcbab17e442a74cb")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

# PreNorm.__init__ takes dim and fn
# PreNorm.forward calls self.ln(x) and self.fn(normalized_x, **kwargs)
# So fn must be a callable module that accepts a tensor and optional kwargs

class DummyModule(nn.Module):
    """A minimal module that accepts a tensor and kwargs"""
    def __init__(self, input_dim, output_dim):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x, **kwargs):
        return self.linear(x)

dim = 4
fn = DummyModule(input_dim=dim, output_dim=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
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("4bdddb9b8d76e1b6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn
from typing import Any, Dict

class PreNorm(nn.Module):
    """Apply a normalization layer before the functional block.

    Args:
        dim: The input dimension size.
        fn: The module or function to be executed after normalization.
    """

    def __init__(self, dim: int, fn: nn.Module) -> None:
        super().__init__()
        self.norm = nn.LayerNorm(dim)
        self.fn = fn

    def forward(self, x: torch.Tensor, **kwargs: Dict[str, Any]) -> torch.Tensor:
        """Normalize token features before applying the wrapped block.

        Args:
            x: Token tensor whose last dimension is ``dim``.
            **kwargs: Extra keyword arguments forwarded to the wrapped module.

        Returns:
            Output tensor returned by ``self.fn`` after layer normalization.
        """
        return self.fn(self.norm(x), **kwargs)


class SimpleBlock(nn.Module):
    def __init__(self, dim: int):
        super().__init__()
        self.linear = nn.Linear(dim, dim)
    
    def forward(self, x: torch.Tensor, **kwargs) -> torch.Tensor:
        return self.linear(x)


INIT_ARGS = {
    'dim': 4,
    'fn': SimpleBlock(4)
}

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

if __name__ == '__main__':
    model = PreNorm(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: torch.Size([2, 3, 4])")
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SDTAEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
mmaaz60/EdgeNeXt/models/edgenext.py
code served (permissive licence) · get_code("7e438b1b13e38d9d")
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, SDTAEncoder: 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
import math

torch.manual_seed(0)

ARGS = {
    'dim': 64,
    'drop_path': 0.1,
    'layer_scale_init_value': 1e-6,
    'expan_ratio': 4,
    'use_pos_emb': True,
    'num_heads': 8,
    'qkv_bias': True,
    'attn_drop': 0.0,
    'drop': 0.0,
    'scales': 2,
}
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 SDTAEncoder — 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 SDTAEncoder 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
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("127b3963437b49e3")
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)

ARGS = {
    "dim": 64,
    "depth": 2,
    "heads": 4,
    "dim_head": 16,
    "mlp_dim": 128,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Transformer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Transformer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("8ae59a8594d1df08")
How it ran

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

import torch
import torch.nn as nn
from einops import rearrange

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "depth": 2,
    "heads": 2,
    "head_dim": 2,
    "mlp_dim": 8,
    "dropout": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Transformer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Transformer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("54a5e3106186035e")
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)

ARGS = {
    "dim": 4,
    "depth": 2,
    "heads": 2,
    "dim_head": 2,
    "mlp_dim": 8,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Transformer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Transformer output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Transformer Ran
ran on a synthesized input
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("09bb5fbbbccebe6b")
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, 3, 5, 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
import torch.nn as nn
from einops import rearrange

class Attention(nn.Module):

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

    def forward(self, x):
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b p n (h d) -> b p h n d', h=self.heads), qkv)
        dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale
        attn = self.attend(dots)
        out = torch.matmul(attn, v)
        out = rearrange(out, 'b p h n d -> b p n (h d)')
        return self.to_out(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.SiLU(), 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, depth, heads, dim_head, mlp_dim, dropout=0.0):
        super().__init__()
        self.layers = nn.ModuleList([])
        for _ in range(depth):
            self.layers.append(nn.ModuleList([PreNorm(dim, Attention(dim, heads, dim_head, dropout)), PreNorm(dim, FeedForward(dim, mlp_dim, 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,
    'depth': 2,
    'heads': 2,
    'dim_head': 2,
    'mlp_dim': 8,
    'dropout': 0.0
}

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

if __name__ == '__main__':
    model = Transformer(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, f"Shape mismatch: {output.shape} vs {ARGS['x'].shape}"
    print("Success!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 5, 4) — shape (2, 3, 5, 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)
Transformer Ran
ran on a synthesized input
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("56bdd39960d3695b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

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

# Input tensor shape: (B, P, N, D) = (2, 3, 5, 4)
ARGS = {
    "x": torch.randn(2, 3, 5, 4)
}
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 — 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)
TransformerEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
jaiwei98/mobile-vit-pytorch/mobile_vit/mobilevit.py
pointer only (licence: NONE) · get_code("bd36e71d0ee3fd10")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jaiwei98/mobile-vit-pytorch 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.

TransformerEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
roydenwa/cell-centroid-former/src/cellcentroidformer/model_architecture.py
pointer only (licence: NONE) · get_code("50c31c18f8304002")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, roydenwa/cell-centroid-former 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.

XCA Ran
ran on a synthesized input · constructed an object; no result was computed
mmaaz60/EdgeNeXt/models/edgenext.py
code served (permissive licence) · get_code("2733c35c71b87333")
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, XCA: 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': 64,
    'num_heads': 8,
    'qkv_bias': False,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type XCA — 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 XCA 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
compact_get_layers Ran
ran; our contract draft was wrong, not the code
roydenwa/cell-centroid-former/src/cellcentroidformer/model_architecture.py
pointer only (licence: NONE) · get_code("cf5208ed947ab445")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, roydenwa/cell-centroid-former 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.

conv_1x1_bn Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from zhoudaquan/rethinking_bottleneck_design
pointer only; the stored copy get_code serves, from zhoudaquan/rethinking_bottleneck_design, is pointer only (licence: NOASSERTION) · get_code("a0131fb70c267a9e")
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.

conv_1x1_bn Ran
ran; our contract draft was wrong, not the code
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("3fb34464dacbb0d3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Sequential. 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 = {
    "inp": 3,
    "oup": 16,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
conv_1x1_bn Ran
ran; our contract draft was wrong, not the code
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("564f22f3b28db627")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Sequential. 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 function conv_1x1_bn takes two integer parameters: inp and oup
# inp: number of input channels
# oup: number of output channels
# These are used to construct Conv2d and BatchNorm2d layers

ARGS = {
    "inp": 3,
    "oup": 16,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
conv_2d Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from jaiwei98/mobile-vit-pytorch
pointer only; the stored copy get_code serves, from jaiwei98/mobile-vit-pytorch, is pointer only (licence: NONE) · get_code("46467acb70052484")
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.

conv_bn Ran
ran; our contract draft was wrong, not the code
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("3fc0fa5c567d1a28")
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 Sequential. 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 = {
    "inp": 3,
    "oup": 16,
    "kernel_size": 3,
    "stride": 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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
conv_nxn_bn Ran
ran; our contract draft was wrong, not the code
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("e01bc963fa545868")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Sequential. 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 = {
    'inp': 3,
    'oup': 16,
    'kernal_size': 3,
    'stride': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
conv_nxn_bn Ran
ran; our contract draft was wrong, not the code
kornia/kornia/kornia/models/vit_mobile.py
code served (permissive licence) · get_code("8d5317047e54ef09")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Sequential. 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 = {
    "inp": 3,
    "oup": 16,
    "kernal_size": 3,
    "stride": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
count_parameters Ran
ran, honoured the contract we drafted
chinhsuanwu/mobilevit-pytorch/mobilevit.py
code served (permissive licence) · get_code("3d1cb4db0a0a03e9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 3)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_patches Ran
ran on a synthesized input
godhj93/MobileViT/utils/nets/MobileViT.py
pointer only (licence: NONE) · get_code("f4179768dbc55e61")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, godhj93/MobileViT 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.

patches_to_image Ran
ran on a synthesized input · constructed an object; no result was computed
godhj93/MobileViT/utils/nets/MobileViT.py
pointer only (licence: NONE) · get_code("fa37ccabf8400bc6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, godhj93/MobileViT 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.

EdgeNeXt Not yet run
unverified (harvested, no recorded run)
mmaaz60/EdgeNeXt/models/edgenext.py
code served (permissive licence) · get_code("d8d7e7e34dc91a1e")
How it ran

no invocation recorded.

InvertedResidual Not yet run
unverified (harvested, no recorded run)
godhj93/MobileViT/utils/nets/MobileViT.py
pointer only (licence: NONE) · get_code("6e05718496381a26")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, godhj93/MobileViT 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.

MobileViT Not yet run
unverified (harvested, no recorded run)
godhj93/MobileViT/utils/nets/MobileViT.py
pointer only (licence: NONE) · get_code("86afc1196b6b0ee1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, godhj93/MobileViT 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.

MobileViT Not yet run
unverified (harvested, no recorded run)
jaiwei98/mobile-vit-pytorch/mobile_vit/mobilevit.py
pointer only (licence: NONE) · get_code("9758df99f0486f48")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, jaiwei98/mobile-vit-pytorch 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.

MobileViT Not yet run
unverified (harvested, no recorded run)
murufeng/awesome_lightweight_networks/light_cnns/Transformer/mobile_vit.py
code served (permissive licence) · get_code("773215bd26648b60")
How it ran

no invocation recorded.

MobileViT Not yet run
unverified (harvested, no recorded run)
xmu-xiaoma666/External-Attention-pytorch/model/backbone/MobileViT.py
code served (permissive licence) · get_code("aee9977341677a30")
How it ran

no invocation recorded.

MobileViT Not yet run
unverified (harvested, no recorded run)
wilile26811249/MobileViT/models/model.py
code served (permissive licence) · get_code("36d81e4406f2c1da")
How it ran

no invocation recorded.

Showing the first 60. An agent gets every one from get_harvested_code_for_paper("2110.02178").

Also present in other papers' code

Of 68 samples lifted from this paper's linked repositories, 68 carry a function identity and 0 do not. Of the 66 distinct functions with an identity, 10 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 8 later) and 56 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
count_parameters 180 other papers
47 dated earlier, 3 the same month, 130 later · 8 only as an assembly brick
1705.08415 (2017-05)
Supervised Community Detection with Line Graph Neural Networks
1707.01926 (2017-07)
Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting
1808.09367 (2018-08)
Deriving Machine Attention from Human Rationales
and 177 more not named here
conv_1x1_bn
brick of this paper's assembly: helper
31 other papers
17 dated earlier, 13 later, 1 same year, order not determinable · 2 only as an assembly brick
1703.07402 (2017-03)
Simple Online and Realtime Tracking with a Deep Association Metric
1801.04381 (2018-01)
MobileNetV2: Inverted Residuals and Linear Bottlenecks
1811.08383 (2018-11)
TSM: Temporal Shift Module for Efficient Video Understanding
and 28 more not named here
LayerNorm 14 other papers
14 later · 9 only as an assembly brick
2201.03545 (2022-01)
A ConvNet for the 2020s
2301.00808 (2023-01)
ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders
2303.15446 (2023-03)
SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications
and 11 more not named here
Transformer
brick of this paper's assembly: model
11 other papers
4 dated earlier, 7 later · 2 only as an assembly brick
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2101.11986 (2021-01)
Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet
2103.14899 (2021-03)
CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification
and 8 more not named here
PositionalEncodingFourier 1 other paper
1 later · 1 only as an assembly brick
2303.15446 (2023-03)
SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications
SDTAEncoder 1 other paper
1 later
2303.15446 (2023-03)
SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications
XCA 1 other paper
1 later · 1 only as an assembly brick
2303.15446 (2023-03)
SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications
conv_1x1_bn
brick of this paper's assembly: helper
1 other paper
1 the same month
2110.09057 (2021-10)
Training Deep Neural Networks with Adaptive Momentum Inspired by the Quadratic Optimization
conv_2d
brick of this paper's assembly: helper
1 other paper
1 later
2206.02680 (2022-06)
Separable Self-attention for Mobile Vision Transformers
conv_nxn_bn
brick of this paper's assembly: helper
1 other paper
1 the same month
2110.09057 (2021-10)
Training Deep Neural Networks with Adaptive Momentum Inspired by the Quadratic Optimization

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

More are linked than shown here.

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

Abstract

Light-weight convolutional neural networks (CNNs) are the de-facto for mobile vision tasks. Their spatial inductive biases allow them to learn representations with fewer parameters across different vision tasks. However, these networks are spatially local. To learn global representations, self-attention-based vision transformers (ViTs) have been adopted. Unlike CNNs, ViTs are heavyweight. In this paper, we ask the following question: is it possible to combine the strengths of CNNs and ViTs to build a light-weight and low latency network for mobile vision tasks? Towards this end, we introduce MobileViT, a light-weight and general-purpose vision transformer for mobile devices. Mobile-ViT presents a different perspective for the global processing of information with transformers. Our results show that MobileViT significantly outperforms CNNand ViT-based networks across different tasks and datasets. On the ImageNet-1k dataset, MobileViT achieves top-1 accuracy of 78.4% with about 6 million parameters, which is 3.2% and 6.2% more accurate than MobileNetv3 (CNN-based) and DeIT (ViT-based) for a similar number of parameters. On the MS-COCO object detection task, MobileViT is 5.7% more accurate than MobileNetv3 for a similar number of parameters. Our source code is open-source and available at: https://github.com/apple/ml-cvnets.

For agents

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

get_harvested_code_for_paper("2110.02178")
get_code_for_paper("2110.02178")
have("2110.02178")

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

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

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

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

Connect an agent — have() is free.