SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2105.01601 · 2021

MLP-Mixer: An all-MLP Architecture for Vision

Thomas Unterthiner, Jakob Uszkoreit, Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Xiaohua Zhai, Neil Houlsby, Jessica Yung, Mario Lucic, Andreas Steiner, Ilya Tolstikhin, Daniel Keysers

arXiv · PDF · Open in the Atlas

Code that ran

114 of 134 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (77 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 1 violated it and 99 have no contract verdict; 10 failures of our instrument; 20 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/2105.01601.json · badge: /api/ran/2105.01601.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
martinsbruveris/tensorflow-image-models community
Papers with Code archive
7 ran · 13 no recorded run
isaaccorley/mlp-mixer-pytorch community
Papers with Code archive
6 ran · 0 no recorded run
Oguzhanercan/MLP-Mixer community
Papers with Code archive
6 ran · 0 no recorded run
engichang1467/MLP-Mixer-Reimplementation community
Papers with Code archive
6 ran · 0 no recorded run
engichang1467/kan-mixer community
Papers with Code archive
5 ran · 2 no recorded run
jaketae/mlp-mixer community
Papers with Code archive
5 ran · 0 no recorded run
lavish619/MLP-Mixer-PyTorch community
Papers with Code archive
5 ran · 0 no recorded run
sradc/nd-mlp-mixer community
Papers with Code archive
5 ran · 0 no recorded run
04RR/SOTA-Vision community
Papers with Code archive
5 ran · 0 no recorded run
KiUngSong/Vision community
Papers with Code archive
5 ran · 0 no recorded run
YeongHyeon/MLP-Mixer-PyTorch community
not in the paper's declared repositories
4 ran · 0 no recorded run
qwopqwop200/MLP-Mixer-tf2 community
not in the paper's declared repositories
4 ran · 0 no recorded run
omihub777/mlp-mixer-cifar community
Papers with Code archive
4 ran · 0 no recorded run
MiuGod0126/Mlp-Mixer-Paddle community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
YeongHyeon/MLP-Mixer-TF2 community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
xuwkk/task_aware_machine_unlearning community
not in the paper's declared repositories
3 ran · 0 no recorded run
himanshu-dutta/MLPMixer-pytorch community
Papers with Code archive
3 ran · 0 no recorded run
leaderj1001/Bag-of-MLP community
Papers with Code archive
3 ran · 0 no recorded run
jankrepl/mildlyoverfitted community
not in the paper's declared repositories
3 ran · 0 no recorded run
xmu-xiaoma666/MLP-Mixer-pytorch community
not in the paper's declared repositories
3 ran · 0 no recorded run
Benjamin-Etheredge/mlp-mixer-keras community
Papers with Code archive
3 ran · 0 no recorded run
ttt496/VisionTransformer community
not in the paper's declared repositories
3 ran · 0 no recorded run
jeonsworld/MLP-Mixer-Pytorch community
Papers with Code archive
3 ran · 0 no recorded run
lucidrains/mlp-mixer-pytorch community
Papers with Code archive
2 ran · 0 no recorded run
Mayurji/Image-Classification-PyTorch community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Affine Ran
ran on a synthesized input
martinsbruveris/tensorflow-image-models/tfimm/architectures/mlp_mixer.py
code served (permissive licence) · get_code("ad0e0b25a1519be8")
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 EagerTensor, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

INIT_ARGS = {}

ARGS = {
    'x': tf.convert_to_tensor(np.random.randn(2, 3, 4).astype(np.float32))
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ChannelMixer Ran
ran on a synthesized input · constructed an object; no result was computed
jaketae/mlp-mixer/mlp_mixer/core.py
code served (permissive licence) · get_code("41e9443e8cca13ef")
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, ChannelMixer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.nn import functional as F

torch.manual_seed(0)

ARGS = {
    "num_features": 4,
    "num_patches": 3,
    "expansion_factor": 2,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ChannelMixer — 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 ChannelMixer 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
Channel_Mixer Ran
ran on a synthesized input · constructed an object; no result was computed
lavish619/MLP-Mixer-PyTorch/mlp_mixer.py
code served (permissive licence) · get_code("7edc696d2a06e258")
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, Channel_Mixer: 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 = {
    'num_channels': 4,
    'expansion': 2,
    'dropout': 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Channel_Mixer — 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 Channel_Mixer 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
Classifier Ran
ran on a synthesized input · constructed an object; no result was computed
isaaccorley/mlp-mixer-pytorch/mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("4de94e8c3fb3d274")
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, Classifier: 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 = {
    "input_dim": 4,
    "num_classes": 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Classifier — 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 Classifier 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
Classifier Ran
ran on a synthesized input · constructed an object; no result was computed
YeongHyeon/MLP-Mixer-PyTorch/neuralnet/mlp_mixer.py
code served (permissive licence) · get_code("27000be093eeda22")
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, Classifier: 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': 4,
    'out_channels': 3,
    'name': 'test_classifier'
}
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 Classifier — 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 Classifier 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
Classifier Ran
ran on a synthesized input · constructed an object; no result was computed
Oguzhanercan/MLP-Mixer/mlp_mixer/mlp_mixer.py
pointer only (licence: NONE) · get_code("f39a76c027d9394c")
How it ran

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

DenseOnAxis Ran
ran on a synthesized input · constructed an object; no result was computed
sradc/nd-mlp-mixer/nd_mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("b3e94ae846f8f7a2")
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, DenseOnAxis: 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 tensorflow as tf
import numpy as np

# Set random seeds for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create a simple activation function
def relu_activation(x):
    return tf.nn.relu(x)

# Define ARGS dict with all parameters for DenseOnAxis
ARGS = {
    'units': 3,
    'axis': -1,
    'activation': relu_activation,
    'kernel_initializer': 'he_uniform',
    'bias_initializer': 'zeros'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DenseOnAxis — 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 DenseOnAxis output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DropPath Ran
ran on a synthesized input
martinsbruveris/tensorflow-image-models/tfimm/architectures/mlp_mixer.py
code served (permissive licence) · get_code("d011b7b14c9b2500")
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 EagerTensor, ndim 3, dtype family float, shape (2, 4, 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 tensorflow as tf
import numpy as np

class DropPath(tf.keras.layers.Layer):
    """
    Per sample stochastic depth when applied in main path of residual blocks

    This is the same as the DropConnect created for EfficientNet, etc networks, however,
    the original name is misleading as 'Drop Connect' is a different form of dropout in
    a separate paper...
    See discussion: https://github.com/tensorflow/tpu/issues/494#issuecomment-532968956
    Following the usage in `timm` we've changed the name to `drop_path`.
    """

    def __init__(self, drop_prob=None, **kwargs):
        super().__init__(**kwargs)
        self.drop_prob = drop_prob
        self.keep_prob = 1.0 - self.drop_prob

    def call(self, x, training=False):
        if not training or not self.drop_prob > 0.0:
            return x
        shape = (tf.shape(x)[0],) + (1,) * (len(tf.shape(x)) - 1)
        random_tensor = self.keep_prob + tf.random.uniform(shape, dtype=x.dtype)
        binary_tensor = tf.floor(random_tensor)
        x = tf.math.divide(x, self.keep_prob) * binary_tensor
        return x


INIT_ARGS = {
    'drop_prob': 0.2,
}

ARGS = {
    'x': tf.constant(np.random.randn(2, 4, 3).astype(np.float32)),
    'training': True,
}

METHOD = 'call'

if __name__ == '__main__':
    layer = DropPath(**INIT_ARGS)
    output = layer(**ARGS)
    print("Output shape:", output.shape)
    print("Output dtype:", output.dtype)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 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)
Embedding Ran
ran on a synthesized input · constructed an object; no result was computed
04RR/SOTA-Vision/MLP_Mixer.py
pointer only (licence: NONE) · get_code("f580308b965b6c05")
How it ran

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

Embedding Ran
ran on a synthesized input · constructed an object; no result was computed
YeongHyeon/MLP-Mixer-PyTorch/neuralnet/mlp_mixer.py
code served (permissive licence) · get_code("e6b70f83068f6b6c")
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, Embedding: 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': 2,
    'name': 'test'
}
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 Embedding — 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 Embedding 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; our contract draft was wrong, not the code
xuwkk/task_aware_machine_unlearning/utils/net.py
pointer only (licence: NONE) · get_code("7ad86819c80a33c6")
How it ran

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

FeedForward Ran
ran; our contract draft was wrong, not the code
lucidrains/mlp-mixer-pytorch/mlp_mixer_pytorch/mlp_mixer_pytorch.py
code served (permissive licence) · get_code("8b62b5d7165745c1")
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 = {
    "dim": 4,
    "dim_hidden": 8,
    "dropout": 0.1,
    "dense": nn.Linear,
}
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
GlobalAveragePooling Ran
ran on a synthesized input · constructed an object; no result was computed
04RR/SOTA-Vision/MLP_Mixer.py
pointer only (licence: NONE) · get_code("da76c73c6c7315ef")
How it ran

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

GlobalAveragePooling Ran
ran on a synthesized input · constructed an object; no result was computed
isaaccorley/mlp-mixer-pytorch/mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("c845b6235851a801")
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, GlobalAveragePooling: 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": 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 GlobalAveragePooling — 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 GlobalAveragePooling 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
GroupNormalization Ran
ran on a synthesized input
martinsbruveris/tensorflow-image-models/tfimm/architectures/mlp_mixer.py
code served (permissive licence) · get_code("2519f1e7c2bd001c")
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 EagerTensor, ndim 4, dtype family float, shape (2, 3, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

# Define initialization arguments for GroupNormalization
INIT_ARGS = {
    'nb_groups': 2,
    'group_size': None,
    'eps': 1e-05,
    'beta_initializer': tf.zeros_initializer(),
    'gamma_initializer': tf.ones_initializer(),
}

# Define arguments for the call method
ARGS = {
    'x': tf.constant(np.random.randn(2, 3, 4, 4).astype(np.float32)),
}

# Import the class
def group_normalize(x, gamma, beta, nb_groups=None, group_size=None, eps=1e-05):
    """
    Applies group-normalization to NHWC ``x`` (see abs/1803.08494, go/dune-gn).

    This function just does the math, if you want a "layer" that creates the
    necessary variables etc., see ``group_norm`` below. You must either specify a fixed
    number of groups ``nb_groups``, which will automatically select a corresponding
    group size depending on the input's number of channels, or you must specify a
    ``group_size``, which leads to an automatic number of groups depending on the
    input's number of channels.

    Author: Lucas Beyer

    Args:
        x: N..C-tensor, the input to group-normalize. For images, this would be a
            NHWC-tensor, for time-series a NTC, for videos a NHWTC or NTHWC, all of
            them work, as normalization includes everything between N and C. Even just
            NC shape works, as C is grouped and normalized.
        gamma: tensor with C entries, learnable scale after normalization.
        beta: tensor with C entries, learnable bias after normalization.
        nb_groups: int, number of groups to normalize over (divides C).
        group_size: int, size of the groups to normalize over (divides C).
        eps: float, a small additive constant to avoid /sqrt(0).

    Returns:
        Group-normalized `x`, of the same shape and type as `x`.
    """
    assert x.shape.ndims >= 2, "Less than 2-dim Tensor passed to GroupNorm. Something's fishy."
    nb_channels = x.shape[-1]
    assert nb_channels is not None, 'Cannot apply GroupNorm on dynamic channels.'
    assert (nb_groups is None) != (group_size is None), 'You must specify exactly one of `num_groups`, `group_size`'
    if group_size is not None:
        nb_groups = nb_channels // group_size
    assert nb_channels % nb_groups == 0, 'GroupNorm: {} not divisible by {}'.format(nb_channels, nb_groups)
    orig_shape = tf.shape(x)
    extra_shape = [nb_groups, nb_channels // nb_groups]
    group_shape = tf.concat([orig_shape[:-1], extra_shape], axis=-1)
    x = tf.reshape(x, group_shape)
    normdims = list(range(1, x.shape.ndims - 2)) + [x.shape.ndims - 1]
    mean, var = tf.nn.moments(x, normdims, keepdims=True)
    beta = tf.reshape(beta, extra_shape)
    gamma = tf.reshape(gamma, extra_shape)
    x = tf.nn.batch_normalization(x, mean, var, beta, gamma, eps)
    return tf.reshape(x, orig_shape)

class GroupNormalization(tf.keras.layers.Layer):
    """
    A group-norm "layer" (see abs/1803.08494 go/dune-gn).

    This function creates beta/gamma variables in a name_scope, and uses them to apply
    ``group_normalize`` on the input ``x``. You can either specify a fixed number of
    groups ``nb_groups``, which will automatically select a corresponding group size
    depending on the input's number of channels, or you must specify a ``group_size``,
    which leads to an automatic number of groups depending on the input's number of
    channels. If you specify neither, the paper's recommended ``nb_groups=32`` is used.

    Authors: Lucas Beyer, Joan Puigcerver.

    Args:
        nb_groups: int, the number of channel-groups to normalize over.
        group_size: int, size of the groups to normalize over.
        eps: float, a small additive constant to avoid /sqrt(0).
        beta_init: initializer for bias, defaults to zeros.
        gamma_init: initializer for scale, defaults to ones.
        **kwargs: other tf.keras.layers.Layer arguments.
    """

    def __init__(self, nb_groups=None, group_size=None, eps=1e-05, beta_initializer=tf.zeros_initializer(), gamma_initializer=tf.ones_initializer(), **kwargs):
        super(GroupNormalization, self).__init__(**kwargs)
        if nb_groups is None and group_size is None:
            nb_groups = 32
        self._nb_groups = nb_groups
        self._group_size = group_size
        self._eps = eps
        self._beta_init = beta_initializer
        self._gamma_init = gamma_initializer

    def build(self, input_size):
        channels = input_size[-1]
        assert channels is not None, 'Cannot apply GN on dynamic channels.'
        self._gamma = self.add_weight(name='gamma', shape=(channels,), initializer=self._gamma_init, dtype=self.dtype)
        self._beta = self.add_weight(name='beta', shape=(channels,), initializer=self._beta_init, dtype=self.dtype)
        super(GroupNormalization, self).build(input_size)

    def call(self, x):
        return group_normalize(x, self._gamma, self._beta, self._nb_groups, self._group_size, self._eps)


# Construct and call the class
layer = GroupNormalization(**INIT_ARGS)
output = layer(**ARGS)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 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)
Head Ran
ran on a synthesized input · constructed an object; no result was computed
KiUngSong/Vision/MLP_Mixer/MLP_Mixer.py
pointer only (licence: NONE) · get_code("4f78c8e4945a1b8d")
How it ran

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

KAN Ran
ran on a synthesized input · constructed an object; no result was computed
engichang1467/kan-mixer/model.py
pointer only (licence: NONE) · get_code("bcf69196a04dbf68")
How it ran

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

KANLinear Ran
ran on a synthesized input · constructed an object; no result was computed
engichang1467/kan-mixer/model.py
pointer only (licence: NONE) · get_code("8b543c9550036e75")
How it ran

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

MLP Ran
ran on a synthesized input · constructed an object; no result was computed
qwopqwop200/MLP-Mixer-tf2/Mlp mixer.py
code served (permissive licence) · get_code("8e0b26191bd100a5")
How it ran

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

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import numpy as np

# Define ARGS dict with all parameters for MLP.__init__
ARGS = {
    'hidden_dim': 8,
    'dropout_ratio': 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
04RR/SOTA-Vision/MLP_Mixer.py
pointer only (licence: NONE) · get_code("47c98c9a2ba62a26")
How it ran

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

MLP Ran
ran on a synthesized input · constructed an object; no result was computed
sradc/nd-mlp-mixer/nd_mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("0e11ca4f0b16f6c6")
How it ran

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

import tensorflow as tf
import numpy as np

# Set random seeds for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create a small input tensor with shape [batch_size, feature_dim]
# Using distinct sizes: batch=2, features=4
input_tensor = tf.constant(np.random.randn(2, 4).astype(np.float32))

ARGS = {
    'outsize': 3,
    'hiddensize': 5,
    'axis': -1,
    'activation': tf.nn.gelu
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
jaketae/mlp-mixer/mlp_mixer/core.py
code served (permissive licence) · get_code("b9633dd450ed0bd2")
How it ran

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

import torch
from torch import nn

torch.manual_seed(0)

ARGS = {
    "num_features": 4,
    "expansion_factor": 3,
    "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 MLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
KiUngSong/Vision/MLP_Mixer/MLP_Mixer.py
pointer only (licence: NONE) · get_code("9c5f554c5720f562")
How it ran

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

MLP Ran
ran on a synthesized input · constructed an object; no result was computed
himanshu-dutta/MLPMixer-pytorch/mlp_mixer/mixer.py
code served (permissive licence) · get_code("a6a7e7e035395b45")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

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

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

MLP Ran
ran on a synthesized input
martinsbruveris/tensorflow-image-models/tfimm/architectures/mlp_mixer.py
code served (permissive licence) · get_code("bb64453aab286990")
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 EagerTensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

def act_layer_factory(act_layer: str):
    """Returns a function that creates the required activation layer."""
    if act_layer in {'linear', 'swish', 'relu', 'gelu', 'sigmoid'}:
        return lambda **kwargs: tf.keras.layers.Activation(act_layer, **kwargs)
    if act_layer == 'relu6':
        return lambda **kwargs: tf.keras.layers.ReLU(max_value=6, **kwargs)
    else:
        raise ValueError(f'Unknown activation: {act_layer}.')

class MLP(tf.keras.layers.Layer):
    """MLP as used in Vision Transformer, MLP-Mixer and related networks"""

    def __init__(self, hidden_dim: int, embed_dim: int, drop_rate: float, act_layer: str, kernel_initializer: str='glorot_uniform', bias_initializer: str='zeros', **kwargs):
        super().__init__(**kwargs)
        act_layer = act_layer_factory(act_layer)
        self.fc1 = tf.keras.layers.Dense(units=hidden_dim, kernel_initializer=kernel_initializer, bias_initializer=bias_initializer, name='fc1')
        self.act = act_layer()
        self.drop1 = tf.keras.layers.Dropout(rate=drop_rate)
        self.fc2 = tf.keras.layers.Dense(units=embed_dim, kernel_initializer=kernel_initializer, bias_initializer=bias_initializer, name='fc2')
        self.drop2 = tf.keras.layers.Dropout(rate=drop_rate)

    def call(self, x, training=False):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop1(x, training=training)
        x = self.fc2(x)
        x = self.drop2(x, training=training)
        return x

INIT_ARGS = {
    'hidden_dim': 8,
    'embed_dim': 4,
    'drop_rate': 0.1,
    'act_layer': 'relu',
    'kernel_initializer': 'glorot_uniform',
    'bias_initializer': 'zeros',
}

ARGS = {
    'x': tf.constant(np.random.randn(2, 4).astype(np.float32)),
    'training': False,
}

mlp = MLP(**INIT_ARGS)
output = mlp(**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
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MLP Ran
ran on a synthesized input
leaderj1001/Bag-of-MLP/model.py
code served (permissive licence) · get_code("dce6173a4414d98a")
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 MLP(nn.Module):

    def __init__(self, dims, multiplxer=4):
        super(MLP, self).__init__()
        hidden = int(dims * multiplxer)
        self.out = nn.Sequential(nn.Linear(dims, hidden), nn.GELU(), nn.Linear(hidden, dims))

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


INIT_ARGS = {
    'dims': 4,
    'multiplxer': 4,
}

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

if __name__ == '__main__':
    model = MLP(**INIT_ARGS)
    output = model(**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 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)
MLP1 Ran
ran on a synthesized input
omihub777/mlp-mixer-cifar/mlp_mixer.py
code served (permissive licence) · get_code("410ae8412478895c")
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
import torch.nn as nn
import torch.nn.functional as F

class MLP1(nn.Module):

    def __init__(self, num_patches, hidden_s, hidden_size, drop_p, off_act):
        super(MLP1, self).__init__()
        self.ln = nn.LayerNorm(hidden_size)
        self.fc1 = nn.Conv1d(num_patches, hidden_s, kernel_size=1)
        self.do1 = nn.Dropout(p=drop_p)
        self.fc2 = nn.Conv1d(hidden_s, num_patches, kernel_size=1)
        self.do2 = nn.Dropout(p=drop_p)
        self.act = F.gelu if not off_act else lambda x: x

    def forward(self, x):
        out = self.do1(self.act(self.fc1(self.ln(x))))
        out = self.do2(self.fc2(out))
        return out + x


INIT_ARGS = {
    'num_patches': 3,
    'hidden_s': 5,
    'hidden_size': 4,
    'drop_p': 0.1,
    'off_act': False,
}

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

if __name__ == '__main__':
    model = MLP1(**INIT_ARGS)
    model.eval()
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, "Shape mismatch!"
    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 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)
MLP2 Ran
ran on a synthesized input
omihub777/mlp-mixer-cifar/mlp_mixer.py
code served (permissive licence) · get_code("2ea11868d051927e")
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
import torch.nn.functional as F

class MLP2(nn.Module):

    def __init__(self, hidden_size, hidden_c, drop_p, off_act):
        super(MLP2, self).__init__()
        self.ln = nn.LayerNorm(hidden_size)
        self.fc1 = nn.Linear(hidden_size, hidden_c)
        self.do1 = nn.Dropout(p=drop_p)
        self.fc2 = nn.Linear(hidden_c, hidden_size)
        self.do2 = nn.Dropout(p=drop_p)
        self.act = F.gelu if not off_act else lambda x: x

    def forward(self, x):
        out = self.do1(self.act(self.fc1(self.ln(x))))
        out = self.do2(self.fc2(out))
        return out + x


INIT_ARGS = {
    'hidden_size': 4,
    'hidden_c': 3,
    'drop_p': 0.1,
    'off_act': False,
}

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

model = MLP2(**INIT_ARGS)
output = model(**ARGS)
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)
MLPBlock Ran
ran on a synthesized input · constructed an object; no result was computed
isaaccorley/mlp-mixer-pytorch/mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("31b7f77ee73cca11")
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, MLPBlock: 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 = {
    "input_dim": 8,
    "hidden_dim": 16,
}
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 MLPBlock — 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 MLPBlock 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
MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
qwopqwop200/MLP-Mixer-tf2/Mlp mixer.py
code served (permissive licence) · get_code("3e264cc60a915db6")
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, MLPMixer: 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# Create a small batch of dummy image data
# Shape: (batch_size, height, width, channels)
# Using batch=2, height=32, width=32, channels=3 for a small RGB image
batch_size = 2
image_height = 32
image_width = 32
image_channels = 3

dummy_images = tf.random.normal((batch_size, image_height, image_width, image_channels))

ARGS = {
    'embed_dim': 8,           # Small embedding dimension
    'token_dim': 16,          # Small token dimension for MLP1
    'channel_dim': 32,        # Small channel dimension for MLP2
    'num_layers': 2,          # Small number of mixer blocks
    'patch_size': 16,         # Patch size (divides 32 evenly)
    'num_classes': 10,        # Small number of output classes
    'patch_method': 'conv'    # Use convolution for patching
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLPMixer — 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 MLPMixer 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
MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
04RR/SOTA-Vision/MLP_Mixer.py
pointer only (licence: NONE) · get_code("f5cb38931808ca7f")
How it ran

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

MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
sradc/nd-mlp-mixer/nd_mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("a086e0a48e89d863")
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, MLPMixer: 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Define ARGS dict with all parameters for MLPMixer
ARGS = {
    'num_classes': 10,
    'num_blocks': 2,
    'patch_size': 4,
    'hidden_dim': 8,
    'tokens_mlp_dim': 16,
    'channels_mlp_dim': 32,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLPMixer — 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 MLPMixer 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
MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
isaaccorley/mlp-mixer-pytorch/mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("d41e7ad565020ce0")
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, MLPMixer: 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 = {
    "num_classes": 10,
    "image_size": 64,
    "channels": 3,
    "patch_size": 16,
    "num_layers": 2,
    "hidden_dim": 128,
    "tokens_hidden_dim": 64,
    "channels_hidden_dim": 256,
}
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 MLPMixer — 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 MLPMixer 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
MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
jaketae/mlp-mixer/mlp_mixer/core.py
code served (permissive licence) · get_code("8e4548f520b433e2")
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, MLPMixer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "image_size": 64,
    "patch_size": 16,
    "in_channels": 3,
    "num_features": 8,
    "expansion_factor": 2,
    "num_layers": 2,
    "num_classes": 10,
    "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 MLPMixer — 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 MLPMixer 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
MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
KiUngSong/Vision/MLP_Mixer/MLP_Mixer.py
pointer only (licence: NONE) · get_code("fe9865eca3cae041")
How it ran

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

MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
himanshu-dutta/MLPMixer-pytorch/mlp_mixer/mixer.py
code served (permissive licence) · get_code("caa83248e49854d5")
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, MLPMixer: 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)

# Construct valid arguments for MLPMixer
ARGS = {
    "img_size": 8,  # 8x8 image
    "img_channels": 3,  # RGB channels
    "num_classes": 10,  # classification task
    "mixer_depth": 2,  # number of mixer layers
    "num_patches": 4,  # 4 patches (2x2 grid)
    "num_channels": 16,  # channels for per-channel FC
    "expansion": 2,  # expansion factor for MLP
    "dropout": 0.1,  # dropout rate
}
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 MLPMixer — 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 MLPMixer 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
MLPMixer Ran
ran; our contract draft was wrong, not the code
xuwkk/task_aware_machine_unlearning/utils/net.py
pointer only (licence: NONE) · get_code("7f963dbc381d1c87")
How it ran

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

MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
engichang1467/MLP-Mixer-Reimplementation/model.py
pointer only (licence: NONE) · get_code("e290ecebd6ae6de8")
How it ran

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

MLPMixer Ran
ran on a synthesized input · constructed an object; no result was computed
Mayurji/Image-Classification-PyTorch/MLPMixer.py
pointer only (licence: GPL-3.0) · get_code("c586a923fcb553e9")
How it ran

The body of this sample is withheld: GPL-3.0, as GitHub detects it on this paper's repository, Mayurji/Image-Classification-PyTorch, is not in the permissive set Syntology serves inline. 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.

MLPMixer Ran
ran on a synthesized input
rishikksh20/MLP-Mixer-pytorch/mlp-mixer.py
code served (permissive licence) · get_code("f6fa8735b66802a3")
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, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn
from einops.layers.torch import Rearrange

class FeedForward(nn.Module):

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

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

class MixerBlock(nn.Module):

    def __init__(self, dim, num_patch, token_dim, channel_dim, dropout=0.0):
        super().__init__()
        self.token_mix = nn.Sequential(nn.LayerNorm(dim), Rearrange('b n d -> b d n'), FeedForward(num_patch, token_dim, dropout), Rearrange('b d n -> b n d'))
        self.channel_mix = nn.Sequential(nn.LayerNorm(dim), FeedForward(dim, channel_dim, dropout))

    def forward(self, x):
        x = x + self.token_mix(x)
        x = x + self.channel_mix(x)
        return x

class MLPMixer(nn.Module):

    def __init__(self, in_channels, dim, num_classes, patch_size, image_size, depth, token_dim, channel_dim):
        super().__init__()
        assert image_size % patch_size == 0, 'Image dimensions must be divisible by the patch size.'
        self.num_patch = (image_size // patch_size) ** 2
        self.to_patch_embedding = nn.Sequential(nn.Conv2d(in_channels, dim, patch_size, patch_size), Rearrange('b c h w -> b (h w) c'))
        self.mixer_blocks = nn.ModuleList([])
        for _ in range(depth):
            self.mixer_blocks.append(MixerBlock(dim, self.num_patch, token_dim, channel_dim))
        self.layer_norm = nn.LayerNorm(dim)
        self.mlp_head = nn.Sequential(nn.Linear(dim, num_classes))

    def forward(self, x):
        x = self.to_patch_embedding(x)
        for mixer_block in self.mixer_blocks:
            x = mixer_block(x)
        x = self.layer_norm(x)
        x = x.mean(dim=1)
        return self.mlp_head(x)


INIT_ARGS = {
    'in_channels': 3,
    'dim': 8,
    'num_classes': 5,
    'patch_size': 4,
    'image_size': 16,
    'depth': 2,
    'token_dim': 12,
    'channel_dim': 16,
}

ARGS = {
    'x': torch.randn(2, 3, 16, 16),
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 5) — shape (2, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MLPMixer Ran
ran on a synthesized input
leaderj1001/Bag-of-MLP/model.py
code served (permissive licence) · get_code("69b06dab05553295")
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, 10) 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

# Compute sequence length: for a 224x224 image with patch_size=32, we get (224/32)^2 = 49 patches
# But we'll use smaller image for speed: 64x64 image with patch_size=16 gives (64/16)^2 = 16 patches
seq_length = 16  # (64/16)^2
in_dims = 3
dims = 4
patch_size = 16
n_classes = 10
N = 2  # number of mixer layers

INIT_ARGS = {
    'seq': seq_length,
    'in_dims': in_dims,
    'dims': dims,
    'patch': patch_size,
    'n_classes': n_classes,
    'N': N,
}

# Input: batch_size=2, channels=3, height=64, width=64
batch_size = 2
height = 64
width = 64

ARGS = {
    'x': torch.randn(batch_size, in_dims, height, width),
}
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, 10) — shape (2, 10) 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)
MLPMixer Ran
ran; our contract draft was wrong, not the code
lucidrains/mlp-mixer-pytorch/mlp_mixer_pytorch/mlp_mixer_pytorch.py
code served (permissive licence) · get_code("ec6123cc6647d830")
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
from functools import partial
from einops.layers.torch import Rearrange, Reduce

torch.manual_seed(0)

ARGS = {
    'image_size': 8,
    'channels': 3,
    'patch_size': 2,
    'dim': 4,
    'depth': 2,
    'num_classes': 10,
    'expansion_factor': 4,
    'expansion_factor_token': 0.5,
    'dropout': 0.1,
}
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 Sequential — a Sequential output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MLPMixer Ran
ran on a synthesized input
omihub777/mlp-mixer-cifar/mlp_mixer.py
code served (permissive licence) · get_code("539a2cb7981bb48e")
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, 10) 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
import torch.nn.functional as F
from einops.layers.torch import Rearrange

class MLP1(nn.Module):

    def __init__(self, num_patches, hidden_s, hidden_size, drop_p, off_act):
        super(MLP1, self).__init__()
        self.ln = nn.LayerNorm(hidden_size)
        self.fc1 = nn.Conv1d(num_patches, hidden_s, kernel_size=1)
        self.do1 = nn.Dropout(p=drop_p)
        self.fc2 = nn.Conv1d(hidden_s, num_patches, kernel_size=1)
        self.do2 = nn.Dropout(p=drop_p)
        self.act = F.gelu if not off_act else lambda x: x

    def forward(self, x):
        out = self.do1(self.act(self.fc1(self.ln(x))))
        out = self.do2(self.fc2(out))
        return out + x

class MLP2(nn.Module):

    def __init__(self, hidden_size, hidden_c, drop_p, off_act):
        super(MLP2, self).__init__()
        self.ln = nn.LayerNorm(hidden_size)
        self.fc1 = nn.Linear(hidden_size, hidden_c)
        self.do1 = nn.Dropout(p=drop_p)
        self.fc2 = nn.Linear(hidden_c, hidden_size)
        self.do2 = nn.Dropout(p=drop_p)
        self.act = F.gelu if not off_act else lambda x: x

    def forward(self, x):
        out = self.do1(self.act(self.fc1(self.ln(x))))
        out = self.do2(self.fc2(out))
        return out + x

class MixerLayer(nn.Module):

    def __init__(self, num_patches, hidden_size, hidden_s, hidden_c, drop_p, off_act):
        super(MixerLayer, self).__init__()
        self.mlp1 = MLP1(num_patches, hidden_s, hidden_size, drop_p, off_act)
        self.mlp2 = MLP2(hidden_size, hidden_c, drop_p, off_act)

    def forward(self, x):
        out = self.mlp1(x)
        out = self.mlp2(out)
        return out

class MLPMixer(nn.Module):

    def __init__(self, in_channels=3, img_size=32, patch_size=4, hidden_size=512, hidden_s=256, hidden_c=2048, num_layers=8, num_classes=10, drop_p=0.0, off_act=False, is_cls_token=False):
        super(MLPMixer, self).__init__()
        num_patches = img_size // patch_size * img_size // patch_size
        self.is_cls_token = is_cls_token
        self.patch_emb = nn.Sequential(nn.Conv2d(in_channels, hidden_size, kernel_size=patch_size, stride=patch_size), Rearrange('b d h w -> b (h w) d'))
        if self.is_cls_token:
            self.cls_token = nn.Parameter(torch.randn(1, 1, hidden_size))
            num_patches += 1
        self.mixer_layers = nn.Sequential(*[MixerLayer(num_patches, hidden_size, hidden_s, hidden_c, drop_p, off_act) for _ in range(num_layers)])
        self.ln = nn.LayerNorm(hidden_size)
        self.clf = nn.Linear(hidden_size, num_classes)

    def forward(self, x):
        out = self.patch_emb(x)
        if self.is_cls_token:
            out = torch.cat([self.cls_token.repeat(out.size(0), 1, 1), out], dim=1)
        out = self.mixer_layers(out)
        out = self.ln(out)
        out = out[:, 0] if self.is_cls_token else out.mean(dim=1)
        out = self.clf(out)
        return out

INIT_ARGS = {
    'in_channels': 3,
    'img_size': 16,
    'patch_size': 4,
    'hidden_size': 64,
    'hidden_s': 32,
    'hidden_c': 128,
    'num_layers': 2,
    'num_classes': 10,
    'drop_p': 0.1,
    'off_act': False,
    'is_cls_token': False,
}

ARGS = {
    'x': torch.randn(2, 3, 16, 16),
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 10) — shape (2, 10) 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)
MLPMixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
04RR/SOTA-Vision/MLP_Mixer.py
pointer only (licence: NONE) · get_code("96afcf6cc663df2e")
How it ran

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

MLP_Block Ran
ran on a synthesized input · constructed an object; no result was computed
lavish619/MLP-Mixer-PyTorch/mlp_mixer.py
code served (permissive licence) · get_code("eb3f0ebc2461a9f7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MLP_Block: 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 = {
    "num_features": 4,
    "expansion": 2,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLP_Block — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP_Block 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
MLP_Mixer Ran
ran on a synthesized input
lavish619/MLP-Mixer-PyTorch/mlp_mixer.py
code served (permissive licence) · get_code("7c550005a69f3e08")
How it ran

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

import torch
from torch import nn

class Channel_Mixer(nn.Module):

    def __init__(self, num_channels, expansion, dropout):
        super(Channel_Mixer, self).__init__()
        self.layer_norm = nn.LayerNorm(num_channels)
        self.mlp_block = MLP_Block(num_channels, expansion, dropout)

    def forward(self, x):
        initial = x
        x = self.layer_norm(x)
        x = self.mlp_block(x)
        output = initial + x
        return output

class MLP_Block(nn.Module):

    def __init__(self, num_features, expansion, dropout):
        super(MLP_Block, self).__init__()
        num_hidden = int(expansion * num_features)
        self.fc1 = nn.Linear(num_features, num_hidden)
        self.dropout = nn.Dropout(dropout)
        self.fc2 = nn.Linear(num_hidden, num_features)
        self.Gelu = nn.GELU()

    def forward(self, x):
        x = self.fc1(x)
        x = self.Gelu(x)
        x = self.dropout(x)
        x = self.fc2(x)
        x = self.dropout(x)
        return x

class Mixer_Layer(nn.Module):

    def __init__(self, num_patches, num_channels, expansion_token, expansion_channel, dropout):
        super(Mixer_Layer, self).__init__()
        self.token_mixer = Token_Mixer(num_patches, num_channels, expansion_token, dropout)
        self.channel_mixer = Channel_Mixer(num_channels, expansion_channel, dropout)

    def forward(self, x):
        x = self.token_mixer(x)
        x = self.channel_mixer(x)
        return x

class Token_Mixer(nn.Module):

    def __init__(self, num_patches, num_channels, expansion, dropout):
        super(Token_Mixer, self).__init__()
        self.layer_norm = nn.LayerNorm(num_channels)
        self.mlp_block = MLP_Block(num_patches, expansion, dropout)

    def forward(self, x):
        initial = x
        x = self.layer_norm(x)
        x = torch.transpose(x, 1, 2)
        x = self.mlp_block(x)
        x = torch.transpose(x, 1, 2)
        output = initial + x
        return output

class MLP_Mixer(nn.Module):

    def __init__(self, image_shape: tuple, patch_size: int, num_classes, num_mixers, num_features, expansion_token=4, expansion_channel=0.5, dropout=0.5):
        super(MLP_Mixer, self).__init__()
        if len(image_shape) == 2:
            in_channel = 1
        elif len(image_shape):
            in_channel = image_shape[2]
        assert image_shape[0] % patch_size == 0
        num_patches = (image_shape[0] // patch_size) ** 2
        self.patch_breaker = nn.Conv2d(in_channel, num_features, kernel_size=patch_size, stride=patch_size)
        layers = []
        for _ in range(num_mixers):
            layers.append(Mixer_Layer(num_patches, num_features, expansion_token, expansion_channel, dropout))
        self.mixer_layers = nn.Sequential(*layers)
        self.final_fc = nn.Linear(num_features, num_classes)

    def forward(self, x):
        patches = self.patch_breaker(x)
        batch_size, num_features, h, w = patches.shape
        patches = patches.permute(0, 2, 3, 1)
        patches = patches.view(batch_size, -1, num_features)
        patches = self.mixer_layers(patches)
        outputs = torch.mean(patches, dim=1)
        outputs = self.final_fc(outputs)
        return outputs

INIT_ARGS = {
    'image_shape': (8, 8, 3),
    'patch_size': 4,
    'num_classes': 5,
    'num_mixers': 2,
    'num_features': 6,
    'expansion_token': 2,
    'expansion_channel': 0.5,
    'dropout': 0.1,
}

ARGS = {
    'x': torch.randn(2, 3, 8, 8),
}
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 — 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)
MLP_Mixer Ran
ran on a synthesized input · constructed an object; no result was computed
Nguyendat-bit/MLP-Mixer/model.py
code served (permissive licence) · get_code("8a603e2c554902c0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MLP_Mixer: 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 tensorflow as tf
from tensorflow.keras.layers import (
    Input, Dense, LayerNormalization, Dropout, GlobalAveragePooling1D, add
)
from tensorflow.keras import models

ARGS = {
    'inp_size': (224, 224, 3),
    'classes': 2,
    'mixer_layer': 8,
    'patch_size': 32,
    'C': 512,
    'Dc': 2048,
    'Ds': 256,
    'dropout': 0.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLP_Mixer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP_Mixer 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
MixBlock Ran
ran on a synthesized input · constructed an object; no result was computed
YeongHyeon/MLP-Mixer-PyTorch/neuralnet/mlp_mixer.py
code served (permissive licence) · get_code("be32575e85bbb425")
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, MixBlock: 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': 4,
    'mix_channels': 8,
    'name': 'test_block'
}
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 MixBlock — 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 MixBlock 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
Mixer Ran
ran on a synthesized input · constructed an object; no result was computed
Oguzhanercan/MLP-Mixer/mlp_mixer/mlp_mixer.py
pointer only (licence: NONE) · get_code("64525509a6ce7a44")
How it ran

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

MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
qwopqwop200/MLP-Mixer-tf2/Mlp mixer.py
code served (permissive licence) · get_code("29ed2ca0ecafeda6")
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, MixerBlock: 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 tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers

# Create a small input tensor for testing
# Shape: (batch_size=2, sequence_length=3, channels=4)
batch_size = 2
sequence_length = 3
channels = 4

# The MixerBlock expects input of shape (batch, seq_len, channels)
# It transposes to (batch, channels, seq_len) for mlp1
# So token_dim should match seq_len and channel_dim should match channels

ARGS = {
    "token_dim": sequence_length,      # matches sequence_length dimension for mlp1
    "channel_dim": channels,            # matches channels dimension for mlp2
    "dropout_ratio": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
jankrepl/mildlyoverfitted/github_adventures/mixer/ours.py
code served (permissive licence) · get_code("0289b1427a389a9a")
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, MixerBlock: 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 = {
    "n_patches": 16,
    "hidden_dim": 8,
    "tokens_mlp_dim": 32,
    "channels_mlp_dim": 24,
}
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 MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input
xmu-xiaoma666/MLP-Mixer-pytorch/mlp_mixer.py
code served (permissive licence) · get_code("126bfb23f004a54a")
How it ran

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

import torch
import numpy as np

# MixerBlock expects:
# - tokens_mlp_dim: number of tokens (sequence length)
# - channels_mlp_dim: number of channels (feature dimension)
# - tokens_hidden_dim: hidden dimension for token mixing MLP
# - channels_hidden_dim: hidden dimension for channel mixing MLP

INIT_ARGS = {
    'tokens_mlp_dim': 16,
    'channels_mlp_dim': 32,
    'tokens_hidden_dim': 8,
    'channels_hidden_dim': 64
}

# Forward expects x with shape (batch_size, tokens, channels)
# tokens must match tokens_mlp_dim, channels must match channels_mlp_dim
ARGS = {
    'x': torch.randn(2, 16, 32)
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
isaaccorley/mlp-mixer-pytorch/mlp_mixer/mlp_mixer.py
code served (permissive licence) · get_code("57d6994f421c54db")
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, MixerBlock: 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 = {
    "num_patches": 5,
    "num_channels": 3,
    "tokens_hidden_dim": 8,
    "channels_hidden_dim": 6,
}
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 MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
asarigun/MixerGANsformer/models.py
code served (permissive licence) · get_code("b190e3a4aa540aa7")
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, MixerBlock: 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.layers.torch import Rearrange

torch.manual_seed(0)

ARGS = {
    'num_patches': 4,
    'chn_dim': 3,
    'tok_hid_dim': 5,
    'chn_hid_dim': 6,
    'p': 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 MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
Benjamin-Etheredge/mlp-mixer-keras/mlp_mixer_keras/mlp_mixer.py
code served (permissive licence) · get_code("98c5586fe72d528c")
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, MixerBlock: 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 tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Add, Dense, Conv2D, GlobalAveragePooling1D, Layer, LayerNormalization, Permute, Softmax, Activation

# Set seed for reproducibility
tf.random.set_seed(0)

# Create a small input tensor for testing
# Shape: (batch_size, num_patches, channel_dim)
batch_size = 2
num_patches = 4
channel_dim = 3
token_mixer_hidden_dim = 8
channel_mixer_hidden_dim = 8

# Create sample input
sample_input = tf.random.normal((batch_size, num_patches, channel_dim))

ARGS = {
    'num_patches': num_patches,
    'channel_dim': channel_dim,
    'token_mixer_hidden_dim': token_mixer_hidden_dim,
    'channel_mixer_hidden_dim': channel_mixer_hidden_dim,
    'activation': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
Mayurji/Image-Classification-PyTorch/MLPMixer.py
pointer only (licence: GPL-3.0) · get_code("dc33df816c641643")
How it ran

The body of this sample is withheld: GPL-3.0, as GitHub detects it on this paper's repository, Mayurji/Image-Classification-PyTorch, is not in the permissive set Syntology serves inline. 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.

MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
ttt496/VisionTransformer/vit_jax/models_mixer.py
code served (permissive licence) · get_code("db2236f3789d5218")
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, MixerBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
import flax.linen as nn

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

# Create a small input tensor: (batch=2, tokens=3, channels=4)
# The function expects x with shape (batch, seq_len, features)
batch_size = 2
num_tokens = 3
num_channels = 4

x = jnp.ones((batch_size, num_tokens, num_channels))

# Define parameters for MixerBlock
tokens_mlp_dim = 8  # Hidden dimension for token mixing MLP
channels_mlp_dim = 16  # Hidden dimension for channel mixing MLP

ARGS = {
    "tokens_mlp_dim": tokens_mlp_dim,
    "channels_mlp_dim": channels_mlp_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input · constructed an object; no result was computed
jeonsworld/MLP-Mixer-Pytorch/models/modeling.py
code served (permissive licence) · get_code("3c517f79359f5f75")
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, MixerBlock: 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 numpy as np
from torch import nn

torch.manual_seed(0)

# Create a minimal config class
class Config:
    def __init__(self):
        self.n_patches = 8  # number of patches (sequence length)
        self.hidden_dim = 16  # hidden dimension
        self.tokens_mlp_dim = 32  # tokens MLP dimension
        self.channels_mlp_dim = 64  # channels MLP dimension

config = Config()

ARGS = {
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MixerBlock — 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 MixerBlock 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
MixerBlock Ran
ran on a synthesized input
xmu-xiaoma666/External-Attention-pytorch/model/mlp/mlp_mixer.py
code served (permissive licence) · get_code("5a26349221c7f507")
How it ran

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

    def __init__(self, input_dim, mlp_dim=512):
        super().__init__()
        self.fc1 = nn.Linear(input_dim, mlp_dim)
        self.gelu = nn.GELU()
        self.fc2 = nn.Linear(mlp_dim, input_dim)

    def forward(self, x):
        return self.fc2(self.gelu(self.fc1(x)))

class MixerBlock(nn.Module):

    def __init__(self, tokens_mlp_dim=16, channels_mlp_dim=1024, tokens_hidden_dim=32, channels_hidden_dim=1024):
        super().__init__()
        self.ln = nn.LayerNorm(channels_mlp_dim)
        self.tokens_mlp_block = MlpBlock(tokens_mlp_dim, mlp_dim=tokens_hidden_dim)
        self.channels_mlp_block = MlpBlock(channels_mlp_dim, mlp_dim=channels_hidden_dim)

    def forward(self, x):
        """
        x: (bs,tokens,channels)
        """
        y = self.ln(x)
        y = y.transpose(1, 2)
        y = self.tokens_mlp_block(y)
        y = y.transpose(1, 2)
        out = x + y
        y = self.ln(out)
        y = out + self.channels_mlp_block(y)
        return y


INIT_ARGS = {
    'tokens_mlp_dim': 5,
    'channels_mlp_dim': 8,
    'tokens_hidden_dim': 12,
    'channels_hidden_dim': 16,
}

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

if __name__ == '__main__':
    mixer_block = MixerBlock(**INIT_ARGS)
    output = mixer_block(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 5, 8)")
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, 5, 8) — shape (2, 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)

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

Also present in other papers' code

Of 134 samples lifted from this paper's linked repositories, 134 carry a function identity and 0 do not. Of the 130 distinct functions with an identity, 28 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 18 the same month, 10 later) and 102 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
is_model 22 other papers
5 dated earlier, 17 later
1409.4842 (2014-09)
Going deeper with convolutions
1512.00567 (2015-12)
Rethinking the Inception Architecture for Computer Vision
1608.06993 (2016-08)
Densely Connected Convolutional Networks
and 19 more not named here
list_models 12 other papers
12 later
2205.10528 (2022-05)
PointVector: A Vector Representation In Point Cloud Analysis
2206.03452 (2022-06)
Can CNNs Be More Robust Than Transformers?
and 9 more not named here
register_model 11 other papers
11 later
2205.10528 (2022-05)
PointVector: A Vector Representation In Point Cloud Analysis
2206.03452 (2022-06)
Can CNNs Be More Robust Than Transformers?
and 8 more not named here
make_divisible 9 other papers
9 later
2203.08392 (2022-03)
Patch-Fool: Are Vision Transformers Always Robust Against Adversarial Perturbations?
2203.14509 (2022-03)
Automated Progressive Learning for Efficient Training of Vision Transformers
2206.00843 (2022-06)
DepthShrinker: A New Compression Paradigm Towards Boosting Real-Hardware Efficiency of Compact Neural Networks
and 6 more not named here
DepthwiseConv2D
brick of this paper's assembly: helper
5 other papers
2 dated earlier, 1 the same month, 2 later
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2105.15203 (2021-05)
SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
and 2 more not named here
FeedForward
brick of this paper's assembly: helper
4 other papers
4 later
2110.09057 (2021-10)
Training Deep Neural Networks with Adaptive Momentum Inspired by the Quadratic Optimization
2312.06330 (2023-12)
Navigating Open Set Scenarios for Skeleton-based Action Recognition
2401.02937 (2024-01)
Locally Adaptive Neural 3D Morphable Models
and 1 more not named here
TransformerMLP
brick of this paper's assembly: model
4 other papers
2 dated earlier, 1 the same month, 1 later
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2105.15203 (2021-05)
SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
and 1 more not named here
PreNormResidual
brick of this paper's assembly: helper, model
2 other papers
2 later
2202.13123 (2022-02)
Content-Variant Reference Image Quality Assessment via Knowledge Distillation
2401.02937 (2024-01)
Locally Adaptive Neural 3D Morphable Models
check_sizes
brick of this paper's assembly: helper
2 other papers
2 the same month
2105.03404 (2021-05)
ResMLP: Feedforward networks for image classification with data-efficient training
2105.08050 (2021-05)
Pay Attention to MLPs
min_max_norm 2 other papers
2 dated earlier
1505.05770 (2015-05)
Variational Inference with Normalizing Flows
1902.02476 (2019-02)
A Simple Baseline for Bayesian Uncertainty in Deep Learning
sorted_list 2 other papers
2 dated earlier
1505.05770 (2015-05)
Variational Inference with Normalizing Flows
1902.02476 (2019-02)
A Simple Baseline for Bayesian Uncertainty in Deep Learning
Affine
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
DropPath
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
GatedBiasInitializer
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
GatedKernelInitializer
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
GatedMLP
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
GluMLP
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
GroupNormalization
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs
KANLinear 1 other paper
1 later · 1 only as an assembly brick
2404.19756 (2024-04)
KAN: Kolmogorov-Arnold Networks
MLP
brick of this paper's assembly: helper
1 other paper
1 the same month · 1 only as an assembly brick
2105.08050 (2021-05)
Pay Attention to MLPs

Shown: the 20 functions present in the most other papers. 8 more shared functions are not listed here.

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

Convolutional Neural Networks (CNNs) are the go-to model for computer vision. Recently, attention-based networks, such as the Vision Transformer, have also become popular. In this paper we show that while convolutions and attention are both sufficient for good performance, neither of them are necessary. We present MLP-Mixer, an architecture based exclusively on multi-layer perceptrons (MLPs). MLP-Mixer contains two types of layers: one with MLPs applied independently to image patches (i.e. "mixing" the per-location features), and one with MLPs applied across patches (i.e. "mixing" spatial information). When trained on large datasets, or with modern regularization schemes, MLP-Mixer attains competitive scores on image classification benchmarks, with pre-training and inference cost comparable to state-of-the-art models. We hope that these results spark further research beyond the realms of well established CNNs and Transformers. 1

For agents

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

get_harvested_code_for_paper("2105.01601")
get_code_for_paper("2105.01601")
have("2105.01601")

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

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

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

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

Connect an agent — have() is free.