SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2201.02973 · CVPR · 2022

MAXIM: Multi-Axis MLP for Image Processing

Han Zhang, Zhengzhong Tu, Alan Bovik, Feng Yang, Peyman Milanfar, Yinxiao Li, Hossein Talebi

arXiv · PDF · Open in the Atlas

Code that ran

31 of 46 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (7 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 13 have no contract verdict; 16 failures of our instrument; 15 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2201.02973.json · badge: /api/ran/2201.02973.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
sayakpaul/maxim-tf community
Papers with Code archive
14 ran · 8 no recorded run
vztu/maxim-pytorch community (classifier label)
classifier basis not recorded on the link
10 ran · 2 no recorded run
google-research/maxim marked official in Papers with Code
Papers with Code archive
7 ran · 5 no recorded run
FunctionStatusWhere it lives
BlockGatingUnit Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("7ed1b7f6a7fca542")
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 function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras import layers
from tensorflow.experimental import numpy as tnp

@tf.keras.utils.register_keras_serializable('maxim')
class SwapAxes(layers.Layer):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def call(self, x, axis_one, axis_two):
        return tnp.swapaxes(x, axis_one, axis_two)

    def get_config(self):
        config = super().get_config().copy()
        return config

def BlockGatingUnit(use_bias: bool=True, name: str='block_gating_unit'):
    """A SpatialGatingUnit as defined in the gMLP paper.

    The 'spatial' dim is defined as the **second last**.
    If applied on other dims, you should swapaxes first.
    """

    def apply(x):
        u, v = tf.split(x, 2, axis=-1)
        v = layers.LayerNormalization(epsilon=1e-06, name=f'{name}_intermediate_layernorm')(v)
        n = K.int_shape(x)[-2]
        v = SwapAxes()(v, -1, -2)
        v = layers.Dense(n, use_bias=use_bias, name=f'{name}_Dense_0')(v)
        v = SwapAxes()(v, -1, -2)
        return u * (v + 1.0)
    return apply

# Create a small test input tensor
# Shape: (batch=2, spatial_dim=3, channels=4)
# The function splits on last axis, so we need even number of channels
test_input = tf.constant([
    [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0]],
    [[13.0, 14.0, 15.0, 16.0], [17.0, 18.0, 19.0, 20.0], [21.0, 22.0, 23.0, 24.0]]
], dtype=tf.float32)

ARGS = {
    'use_bias': True,
    'name': 'block_gating_unit'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BlockGmlpLayer Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("9f6816f577e4daf7")
How it ran

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

import tensorflow as tf
import numpy as np

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

# Create a small test input tensor
# Shape: (batch=2, height=8, width=8, channels=4)
test_input = tf.random.normal((2, 8, 8, 4), dtype=tf.float32)

# Define arguments for BlockGmlpLayer
ARGS = {
    'block_size': (4, 4),  # (fh, fw) - block height and width
    'use_bias': True,
    'factor': 2,
    'dropout_rate': 0.0,
    'name': 'block_gmlp_test'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CALayer Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("19b896e6c80f7746")
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, CALayer: 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 functools
import jax
import jax.numpy as jnp
import flax.linen as nn

Conv1x1 = functools.partial(nn.Conv, kernel_size=(1, 1))

class CALayer(nn.Module):
    """Squeeze-and-excitation block for channel attention.

    ref: https://arxiv.org/abs/1709.01507
    """
    features: int
    reduction: int = 4
    use_bias: bool = True

    @nn.compact
    def __call__(self, x):
        y = jnp.mean(x, axis=[1, 2], keepdims=True)
        y = Conv1x1(self.features // self.reduction, use_bias=self.use_bias)(y)
        y = nn.relu(y)
        y = Conv1x1(self.features, use_bias=self.use_bias)(y)
        y = nn.sigmoid(y)
        return x * y

ARGS = {
    'features': 4,
    'reduction': 2,
    'use_bias': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CALayer — 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 CALayer 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
CALayer Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("324d6a11c6374570")
How it ran

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

import tensorflow as tf
import numpy as np

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

# Create a small test input tensor
# Shape: (batch_size=2, height=4, width=3, channels=16)
test_input = tf.random.normal((2, 4, 3, 16), dtype=tf.float32)

# Define arguments for CALayer
ARGS = {
    'num_channels': 16,
    'reduction': 4,
    'use_bias': True,
    'name': 'channel_attention'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CrossGatingBlock Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("766dd58d53750085")
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, CrossGatingBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

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

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

# Define ARGS dictionary with all parameters for CrossGatingBlock
ARGS = {
    "features": 16,
    "block_size": (4, 4),
    "grid_size": (2, 2),
    "dropout_rate": 0.1,
    "input_proj_factor": 2,
    "upsample_y": True,
    "use_bias": True,
}

# Create sample inputs for the __call__ method
# x shape: (batch=2, height=8, width=8, channels=16)
x = jnp.ones((2, 8, 8, 16), dtype=jnp.float32)

# y shape: (batch=2, height=4, width=4, channels=16) - will be upsampled to (2, 8, 8, 16)
y = jnp.ones((2, 4, 4, 16), dtype=jnp.float32)

# deterministic flag for dropout
deterministic = True
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CrossGatingBlock — 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 CrossGatingBlock 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
GetSpatialGatingWeights Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("084dcbcab94aaf9e")
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, GetSpatialGatingWeights: 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 a seed for reproducibility
key = jax.random.PRNGKey(0)

# Create a tiny input tensor for testing
# Shape: (batch, height, width, channels)
# Using distinct sizes: batch=2, height=8, width=12, channels=4
x = jnp.ones((2, 8, 12, 4), dtype=jnp.float32)

# Initialize the model parameters
ARGS = {
    'features': 4,
    'block_size': (4, 3),  # (fh, fw) - distinct dimensions
    'grid_size': (2, 2),   # (gh, gw) - distinct dimensions
    'input_proj_factor': 2,
    'dropout_rate': 0.1,
    'use_bias': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GetSpatialGatingWeights — 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 GetSpatialGatingWeights 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
GetSpatialGatingWeights Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("258edcba99050dce")
How it ran

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

import tensorflow as tf
import numpy as np

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

# Create a small input tensor for testing
# Shape: (batch_size=2, height=8, width=8, channels=4)
input_tensor = tf.random.normal([2, 8, 8, 4], dtype=tf.float32)

# Define ARGS dict with all required parameters
ARGS = {
    'features': 4,
    'block_size': (4, 4),  # patch_size for TFBlockImages
    'grid_size': (2, 2),   # grid_size for TFBlockImagesByGrid
    'input_proj_factor': 2,
    'dropout_rate': 0.0,
    'use_bias': True,
    'name': 'spatial_gating'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
GridGatingUnit Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("9ec31f74d265cc86")
How it ran

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

import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras import layers
from tensorflow.experimental import numpy as tnp

@tf.keras.utils.register_keras_serializable('maxim')
class SwapAxes(layers.Layer):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def call(self, x, axis_one, axis_two):
        return tnp.swapaxes(x, axis_one, axis_two)

    def get_config(self):
        config = super().get_config().copy()
        return config

def GridGatingUnit(use_bias: bool=True, name: str='grid_gating_unit'):
    """A SpatialGatingUnit as defined in the gMLP paper.

    The 'spatial' dim is defined as the second last.
    If applied on other dims, you should swapaxes first.
    """

    def apply(x):
        u, v = tf.split(x, 2, axis=-1)
        v = layers.LayerNormalization(epsilon=1e-06, name=f'{name}_intermediate_layernorm')(v)
        n = K.int_shape(x)[-3]
        v = SwapAxes()(v, -1, -3)
        v = layers.Dense(n, use_bias=use_bias, name=f'{name}_Dense_0')(v)
        v = SwapAxes()(v, -1, -3)
        return u * (v + 1.0)
    return apply

# Create valid arguments for GridGatingUnit
ARGS = {
    'use_bias': True,
    'name': 'grid_gating_unit'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
GridGmlpLayer Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("05dca5627244f135")
How it ran

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

import tensorflow as tf
import numpy as np

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

# Create a small input tensor matching what GridGmlpLayer expects
# Shape: (batch, height, width, channels)
# Using distinct sizes: batch=2, height=4, width=3, channels=5
batch_size = 2
height = 4
width = 3
num_channels = 5

input_tensor = tf.random.normal((batch_size, height, width, num_channels), dtype=tf.float32)

# Define grid size that divides height and width evenly
# height=4 divisible by 2, width=3 divisible by 3
grid_size = (2, 3)

# Build ARGS dict with all parameters for GridGmlpLayer
ARGS = {
    'grid_size': grid_size,
    'use_bias': True,
    'factor': 2,
    'dropout_rate': 0.1,
    'name': 'grid_gmlp_test'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MlpBlock Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("e60caa8706cbaa5e")
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 jax
import jax.numpy as jnp
import flax.linen as nn

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

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

# Define arguments for MlpBlock
ARGS = {
    "mlp_dim": 8,
    "dropout_rate": 0.1,
    "use_bias": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
MlpBlock Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("4cbc099a6c833993")
How it ran

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

import tensorflow as tf
import numpy as np

# Create a small input tensor for testing
# Shape: (batch_size=2, sequence_length=5, feature_dim=4)
input_tensor = tf.constant(
    np.random.randn(2, 5, 4).astype(np.float32)
)

# Define the arguments dictionary
ARGS = {
    'mlp_dim': 8,
    'dropout_rate': 0.1,
    'use_bias': True,
    'name': 'mlp_block'
}

# Create the MLP block function
def MlpBlock(mlp_dim: int, dropout_rate: float=0.0, use_bias: bool=True, name: str='mlp_block'):
    """A 1-hidden-layer MLP block, applied over the last dimension."""

    def apply(x):
        d = tf.keras.backend.int_shape(x)[-1]
        x = tf.keras.layers.Dense(mlp_dim, use_bias=use_bias, name=f'{name}_Dense_0')(x)
        x = tf.nn.gelu(x, approximate=True)
        x = tf.keras.layers.Dropout(dropout_rate)(x)
        x = tf.keras.layers.Dense(d, use_bias=use_bias, name=f'{name}_Dense_1')(x)
        return x
    return apply

# Test execution
mlp_fn = MlpBlock(**ARGS)
output = mlp_fn(input_tensor)
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
RCAB Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("a848dc175add161e")
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, RCAB: 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
import functools

# Define Conv1x1 and Conv3x3 as they're used in the module
Conv1x1 = functools.partial(nn.Conv, kernel_size=(1, 1))
Conv3x3 = functools.partial(nn.Conv, kernel_size=(3, 3))

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

# Define ARGS dict with all parameters for RCAB
ARGS = {
    'features': 5,
    'reduction': 4,
    'lrelu_slope': 0.2,
    'use_bias': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RCAB — 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 RCAB 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
RCAB Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("5333727b65d8f4e5")
How it ran

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

import 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 RCAB
ARGS = {
    'num_channels': 16,
    'reduction': 4,
    'lrelu_slope': 0.2,
    'use_bias': True,
    'name': 'residual_ca'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
RDCAB Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("1fdc0576592cc66d")
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, RDCAB: 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
import functools

# Define the weight initializer as used in the module
weight_initializer = nn.initializers.normal(stddev=0.02)

# Define Conv1x1 as used in CALayer
Conv1x1 = functools.partial(nn.Conv, kernel_size=(1, 1))

# Define MlpBlock as used in RDCAB
class MlpBlock(nn.Module):
    """A 1-hidden-layer MLP block, applied over the last dimension."""
    mlp_dim: int
    dropout_rate: float = 0.0
    use_bias: bool = True

    @nn.compact
    def __call__(self, x, deterministic=True):
        n, h, w, d = x.shape
        x = nn.Dense(self.mlp_dim, use_bias=self.use_bias, kernel_init=weight_initializer)(x)
        x = nn.gelu(x)
        x = nn.Dropout(rate=self.dropout_rate)(x, deterministic)
        x = nn.Dense(d, use_bias=self.use_bias, kernel_init=weight_initializer)(x)
        return x

# Define CALayer as used in RDCAB
class CALayer(nn.Module):
    """Squeeze-and-excitation block for channel attention."""
    features: int
    reduction: int = 4
    use_bias: bool = True

    @nn.compact
    def __call__(self, x):
        y = jnp.mean(x, axis=[1, 2], keepdims=True)
        y = Conv1x1(self.features // self.reduction, use_bias=self.use_bias)(y)
        y = nn.relu(y)
        y = Conv1x1(self.features, use_bias=self.use_bias)(y)
        y = nn.sigmoid(y)
        return x * y

# Define RDCAB
class RDCAB(nn.Module):
    """Residual dense channel attention block. Used in Bottlenecks."""
    features: int
    reduction: int = 16
    use_bias: bool = True
    dropout_rate: float = 0.0

    @nn.compact
    def __call__(self, x, deterministic=True):
        y = nn.LayerNorm(name='LayerNorm')(x)
        y = MlpBlock(mlp_dim=self.features, dropout_rate=self.dropout_rate, use_bias=self.use_bias, name='channel_mixing')(y, deterministic=deterministic)
        y = CALayer(features=self.features, reduction=self.reduction, use_bias=self.use_bias, name='channel_attention')(y)
        x = x + y
        return x

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

# Set up arguments for RDCAB instantiation and call
ARGS = {
    "features": 8,
    "reduction": 4,
    "use_bias": True,
    "dropout_rate": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RDCAB — 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 RDCAB 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
RDCAB Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("d3804c01fc7b2d0b")
How it ran

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

import tensorflow as tf
import functools
from tensorflow.keras import backend as K
from tensorflow.keras import layers

# Define Conv1x1 as used in the code
Conv1x1 = functools.partial(layers.Conv2D, kernel_size=(1, 1), padding='same')

def CALayer(num_channels: int, reduction: int=4, use_bias: bool=True, name: str='channel_attention'):
    """Squeeze-and-excitation block for channel attention."""
    def apply(x):
        y = layers.GlobalAvgPool2D(keepdims=True)(x)
        y = Conv1x1(filters=num_channels // reduction, use_bias=use_bias, name=f'{name}_Conv_0')(y)
        y = tf.nn.relu(y)
        y = Conv1x1(filters=num_channels, use_bias=use_bias, name=f'{name}_Conv_1')(y)
        y = tf.nn.sigmoid(y)
        return x * y
    return apply

def MlpBlock(mlp_dim: int, dropout_rate: float=0.0, use_bias: bool=True, name: str='mlp_block'):
    """A 1-hidden-layer MLP block, applied over the last dimension."""
    def apply(x):
        d = K.int_shape(x)[-1]
        x = layers.Dense(mlp_dim, use_bias=use_bias, name=f'{name}_Dense_0')(x)
        x = tf.nn.gelu(x, approximate=True)
        x = layers.Dropout(dropout_rate)(x)
        x = layers.Dense(d, use_bias=use_bias, name=f'{name}_Dense_1')(x)
        return x
    return apply

def RDCAB(num_channels: int, reduction: int=16, use_bias: bool=True, dropout_rate: float=0.0, name: str='rdcab'):
    """Residual dense channel attention block. Used in Bottlenecks."""
    def apply(x):
        y = layers.LayerNormalization(epsilon=1e-06, name=f'{name}_LayerNorm')(x)
        y = MlpBlock(mlp_dim=num_channels, dropout_rate=dropout_rate, use_bias=use_bias, name=f'{name}_channel_mixing')(y)
        y = CALayer(num_channels=num_channels, reduction=reduction, use_bias=use_bias, name=f'{name}_channel_attention')(y)
        x = x + y
        return x
    return apply

# Create test input tensor: batch_size=2, height=4, width=3, channels=8
test_input = tf.random.normal((2, 4, 3, 8))

# Build RDCAB layer
rdcab_layer = RDCAB(
    num_channels=8,
    reduction=2,
    use_bias=True,
    dropout_rate=0.1,
    name='test_rdcab'
)

# Test the layer
output = rdcab_layer(test_input)

# Define ARGS dictionary with all parameters
ARGS = {
    'num_channels': 8,
    'reduction': 2,
    'use_bias': True,
    'dropout_rate': 0.1,
    'name': 'test_rdcab'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Resizing Ran
ran on a synthesized input
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("03c67e5e165e1da6")
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; 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 = {
    'ratio': 0.5,
    'method': 'bilinear',
    'antialias': True
}

# Create a small batch of images: batch=2, height=4, width=3, channels=1
input_images = tf.constant(np.random.rand(2, 4, 3, 1).astype(np.float32))

ARGS = {
    'img': input_images
}
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 — 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)
SAM Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("e1002ec72887a8e7")
How it ran

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

import tensorflow as tf
import numpy as np

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

# Create small test tensors
# x: output from UNet decoder with shape (batch, height, width, channels)
batch_size = 2
height = 4
width = 4
num_channels_val = 8
output_channels_val = 3

x_test = tf.random.normal((batch_size, height, width, num_channels_val))
x_image_test = tf.random.normal((batch_size, height, width, 3))

# Build the SAM function to verify it works
sam_apply = __import__('functools').partial(
    tf.keras.layers.Conv2D,
    kernel_size=(3, 3),
    padding='same'
)

# Test the SAM function signature
def test_sam():
    from functools import partial
    Conv3x3 = partial(tf.keras.layers.Conv2D, kernel_size=(3, 3), padding='same')
    
    def SAM(num_channels: int, output_channels: int=3, use_bias: bool=True, name: str='sam'):
        def apply(x, x_image):
            x1 = Conv3x3(filters=num_channels, use_bias=use_bias, name=f'{name}_Conv_0')(x)
            if output_channels == 3:
                image = Conv3x3(filters=output_channels, use_bias=use_bias, name=f'{name}_Conv_1')(x) + x_image
            else:
                image = Conv3x3(filters=output_channels, use_bias=use_bias, name=f'{name}_Conv_1')(x)
            x2 = tf.nn.sigmoid(Conv3x3(filters=num_channels, use_bias=use_bias, name=f'{name}_Conv_2')(image))
            x1 = x1 * x2
            x1 = x1 + x
            return (x1, image)
        return apply
    
    return SAM

SAM_func = test_sam()

# Define ARGS dict with all parameters
ARGS = {
    'num_channels': 8,
    'output_channels': 3,
    'use_bias': True,
    'name': 'sam'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SwapAxes Ran
ran on a synthesized input
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("cc569d6b5f02b960")
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; 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 = {}

METHOD = 'call'

x = tf.constant(np.random.randn(2, 3, 4, 5).astype(np.float32))
axis_one = 1
axis_two = 3

ARGS = {
    'x': x,
    'axis_one': axis_one,
    'axis_two': axis_two
}
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 — 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)
TFBlockImages Ran
ran on a synthesized input
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("61cbfaf1cb7f570e")
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 list. 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 import layers

@tf.keras.utils.register_keras_serializable('maxim')
class TFBlockImages(layers.Layer):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def call(self, image, patch_size):
        bs, h, w, num_channels = (tf.shape(image)[0], tf.shape(image)[1], tf.shape(image)[2], tf.shape(image)[3])
        ph, pw = patch_size
        gh = h // ph
        gw = w // pw
        pad = [[0, 0], [0, 0]]
        patches = tf.space_to_batch_nd(image, [ph, pw], pad)
        patches = tf.split(patches, ph * pw, axis=0)
        patches = tf.stack(patches, 3)
        patches_dim = tf.shape(patches)
        patches = tf.reshape(patches, [patches_dim[0], patches_dim[1], patches_dim[2], -1])
        patches = tf.reshape(patches, (patches_dim[0], patches_dim[1] * patches_dim[2], ph * pw, num_channels))
        return [patches, gh, gw]

    def get_config(self):
        return super().get_config()


INIT_ARGS = {}

ARGS = {
    'image': tf.random.normal((2, 8, 12, 3)),
    'patch_size': (2, 3)
}

METHOD = 'call'

if __name__ == '__main__':
    layer = TFBlockImages(**INIT_ARGS)
    result = layer(**ARGS)
    print("Output patches shape:", tf.shape(result[0]))
    print("Grid height:", result[1])
    print("Grid width:", result[2])
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
UpSampleRatio Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("42206e2f2fad7d53")
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, UpSampleRatio: 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

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

ARGS = {
    "features": 8,
    "ratio": 2.0,
    "use_bias": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type UpSampleRatio — 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 UpSampleRatio 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
UpSampleRatio Ran
ran; our contract draft was wrong, not the code
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("612b66e64a594d39")
How it ran

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

import tensorflow as tf
import numpy as np

# Create a small test input tensor
# Shape: (batch=2, height=4, width=3, channels=5)
test_input = tf.constant(
    np.random.randn(2, 4, 3, 5).astype(np.float32)
)

# Define ARGS dictionary with all parameters for UpSampleRatio
ARGS = {
    'num_channels': 16,
    'ratio': 2.0,
    'use_bias': True,
    'name': 'upsample'
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
block_images_einops Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vztu/maxim-pytorch/maxim_pytorch/maxim_torch.py
code served (permissive licence) · get_code("8a67f23552a44d61")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 24, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import einops

torch.manual_seed(0)

# Create a small test image tensor
# Shape: (batch, height, width, channels)
# Using distinct sizes: batch=2, height=8, width=12, channels=3
x = torch.randn(2, 8, 12, 3)

# Define patch size as a tuple
patch_size = (4, 6)

ARGS = {
    'x': x,
    'patch_size': patch_size
}
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 Tensor, ndim 4, dtype family float, shape (2, 4, 24, 3) — shape (2, 4, 24, 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: none by the harness; any seed is in the setup block
calculate_psnr Ran
ran; our contract draft was wrong, not the code
vztu/maxim-pytorch/Deblurring/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from AlifAshrafee/Restoring-Without-Forgetting, is pointer only (licence: NONE) · get_code("d292dd965ab59629")
How it ran

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

calculate_ssim Ran
ran; our contract draft was wrong, not the code
vztu/maxim-pytorch/Deblurring/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from AlifAshrafee/Restoring-Without-Forgetting, is pointer only (licence: NONE) · get_code("a05b184dc6c264a0")
How it ran

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

compute_psnr Ran
ran, violated the contract we drafted
vztu/maxim-pytorch/Deblurring/evaluate_realblur.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from invokerer/deeprft, is pointer only (licence: NOASSERTION) · get_code("91fa50e293bf2fde")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from invokerer/deeprft, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_params Ran
ran on a synthesized input
vztu/maxim-pytorch/maxim_pytorch/jax2torch.py
code served (permissive licence) · get_code("1b0d800507b48241")
How it ran

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

import collections
import io
import numpy as np
import tensorflow as tf
import tempfile
import os

# Create a temporary checkpoint file in numpy format
# The function expects a file that can be read with np.load
temp_dir = tempfile.mkdtemp()
ckpt_path = os.path.join(temp_dir, "checkpoint.npz")

# Build a nested parameter structure matching what the function expects
# The function extracts params['opt']['target'], so we need that structure
params_dict = {
    'opt/target/layer1/weights': np.array([1.0, 2.0, 3.0, 4.0]),
    'opt/target/layer1/bias': np.array([0.1, 0.2]),
    'opt/target/layer2/weights': np.array([[1.0, 2.0], [3.0, 4.0]]),
}

# Save as npz file
np.savez(ckpt_path, **params_dict)

ARGS = {
    'ckpt_path': ckpt_path,
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
modify_jax_params Ran
ran on a synthesized input
vztu/maxim-pytorch/maxim_pytorch/jax2torch.py
code served (permissive licence) · get_code("24049a3abbb124a4")
How it ran

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

import torch
import numpy as np

torch.manual_seed(0)

# Create a flat JAX parameter dictionary with various shapes and structures
flat_jax_dict = {
    # 1D case - should be squeezed
    'model/bias': np.array([0.1, 0.2, 0.3, 0.4]),
    
    # 2D case with 'kernel' - should be transposed
    'model/layer/kernel': np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]),
    
    # 2D case without 'kernel' - should not be transposed
    'model/layer/scale': np.array([[0.5, 0.6], [0.7, 0.8]]),
    
    # 4D case with 'kernel' - should be permuted (3, 2, 0, 1)
    'model/conv/kernel': np.random.randn(2, 3, 4, 5),
    
    # 4D ConvTranspose case - should be permuted to (1, 0, 2, 3) after initial permute
    'model/ConvTranspose_0/kernel': np.random.randn(3, 4, 2, 2),
    
    # LayerNorm scale case
    'model/LayerNorm/scale': np.array([1.0, 2.0, 3.0, 4.0]),
    
    # LayerNorm bias case
    'model/LayerNorm/bias': np.array([0.1, 0.2, 0.3, 0.4]),
    
    # layernorm (lowercase) scale case
    'model/layernorm/scale': np.array([1.1, 2.1, 3.1, 4.1]),
    
    # layernorm (lowercase) bias case
    'model/layernorm/bias': np.array([0.5, 0.6, 0.7, 0.8]),
}

ARGS = {
    'flat_jax_dict': flat_jax_dict
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
nearest_downsample Ran
ran on a synthesized input
vztu/maxim-pytorch/maxim_pytorch/maxim_torch.py
code served (permissive licence) · get_code("ecee36a6f46993db")
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 Tensor, ndim 4, dtype family float, shape (2, 4, 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 numpy as np
import torch

torch.manual_seed(0)

# Create a small 4D tensor (batch, channels, height, width)
# Using distinct sizes: batch=2, channels=4, height=8, width=6
x = torch.randn(2, 4, 8, 6)

# Downsample ratio - scale factor between 0 and 1
ratio = 0.5

ARGS = {
    "x": x,
    "ratio": ratio
}
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 Tensor, ndim 4, dtype family float, shape (2, 4, 4, 3) — shape (2, 4, 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: none by the harness; any seed is in the setup block
recover_tree Ran
ran; our contract draft was wrong, not the code
vztu/maxim-pytorch/maxim_pytorch/jax2torch.py
code served (permissive licence) · get_code("2a480b42a952d169")
How it ran

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

import collections
import torch
import numpy as np

torch.manual_seed(0)

# Construct arguments for recover_tree function
# The function takes:
# - keys: a list of keys with '/' as separator
# - values: a list of leaf values

# Example: create a nested structure with some flat keys and some hierarchical keys
keys = [
    'simple_key',
    'model/layer1/weight',
    'model/layer1/bias',
    'model/layer2/weight',
    'config/learning_rate',
    'config/batch_size',
    'data/train',
    'data/test'
]

values = [
    42,
    torch.randn(2, 4),
    torch.randn(4),
    torch.randn(3, 2),
    0.001,
    32,
    torch.randn(2, 4),
    torch.randn(2, 4)
]

ARGS = {
    'keys': keys,
    'values': values
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ssim Ran
ran, honoured the contract we drafted
vztu/maxim-pytorch/Deblurring/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from AlifAshrafee/Restoring-Without-Forgetting, is pointer only (licence: NONE) · get_code("ba721aeacc165234")
How it ran

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

unblock_images_einops Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
vztu/maxim-pytorch/maxim_pytorch/maxim_torch.py
code served (permissive licence) · get_code("627ea4c76565d927")
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 Tensor, ndim 4, dtype family float, shape (2, 6, 12, 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
import einops

torch.manual_seed(0)

# Analyze the function:
# - x: a tensor that will be rearranged
# - grid_size: tuple/list with 2 elements (gh, gw)
# - patch_size: tuple/list with 2 elements (fh, fw)
#
# The rearrange operation expects:
# Input shape: n (gh gw) (fh fw) c
# Output shape: n (gh fh) (gw fw) c
#
# Let's choose:
# - n = 2 (batch size)
# - gh = 3, gw = 4 (grid dimensions - distinct)
# - fh = 2, fw = 3 (patch dimensions - distinct)
# - c = 5 (channels - distinct)
#
# Input tensor shape: (2, 12, 6, 5) = (n, gh*gw, fh*fw, c)

n = 2
gh, gw = 3, 4
fh, fw = 2, 3
c = 5

# Create input tensor with shape (n, gh*gw, fh*fw, c)
x = torch.randn(n, gh*gw, fh*fw, c)

grid_size = (gh, gw)
patch_size = (fh, fw)

ARGS = {
    'x': x,
    'grid_size': grid_size,
    'patch_size': patch_size
}
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 Tensor, ndim 4, dtype family float, shape (2, 6, 12, 5) — shape (2, 6, 12, 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: none by the harness; any seed is in the setup block
BottleneckBlock Not yet run
unverified (harvested, no recorded run)
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("1f82af068fbcb99b")
How it ran

no invocation recorded.

BottleneckBlock Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("8f3bf5e1e1ab7a8a")
How it ran

no invocation recorded.

CrossGatingBlock Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("ccc6692913775565")
How it ran

no invocation recorded.

MAXIM Not yet run
unverified (harvested, no recorded run)
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("cf9ff379ec874bea")
How it ran

no invocation recorded.

MAXIM Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("fa1baf06efa9af1a")
How it ran

no invocation recorded.

ResidualSplitHeadMultiAxisGmlpLayer Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("2a2c1a868e2dcde6")
How it ran

no invocation recorded.

SAM Not yet run
unverified (harvested, no recorded run)
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("5677718f64cf57a1")
How it ran

no invocation recorded.

TFBlockImagesByGrid Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("bfc4a56270266181")
How it ran

no invocation recorded.

TFUnblockImages Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("bbe59c0f7d80a435")
How it ran

no invocation recorded.

UNetDecoderBlock Not yet run
unverified (harvested, no recorded run)
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("368f5be0ac386cea")
How it ran

no invocation recorded.

UNetDecoderBlock Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("388ba9abc6d6edcf")
How it ran

no invocation recorded.

UNetEncoderBlock Not yet run
unverified (harvested, no recorded run)
google-research/maxim/maxim/models/maxim.py
code served (permissive licence) · get_code("65880b9a096f0b2e")
How it ran

no invocation recorded.

UNetEncoderBlock Not yet run
unverified (harvested, no recorded run)
sayakpaul/maxim-tf/maxim/maxim.py
code served (permissive licence) · get_code("8cae04426d07cd86")
How it ran

no invocation recorded.

compute_ssim Not yet run
unverified (harvested, no recorded run)
vztu/maxim-pytorch/Deblurring/evaluate_realblur.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from invokerer/deeprft, is pointer only (licence: NOASSERTION) · get_code("464c3d3b7a1eb4b3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from invokerer/deeprft, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

image_align Not yet run
unverified (harvested, no recorded run)
vztu/maxim-pytorch/Deblurring/evaluate_realblur.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from INVOKERer/AdaRevD, is pointer only (licence: NOASSERTION) · get_code("5aad1c1e328fd4ec")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from INVOKERer/AdaRevD, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 46 samples lifted from this paper's linked repositories, 46 carry a function identity and 0 do not. Of the 46 distinct functions with an identity, 9 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 8 later) and 37 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
ssim 18 other papers
3 dated earlier, 14 later, 1 same year, order not determinable
1809.00219 (2018-09)
ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks
1904.03377 (2019-04)
Blind Super-Resolution With Iterative Kernel Correction
2005.05650 (2020-05)
Invertible Image Rescaling
and 15 more not named here
calculate_psnr 9 other papers
8 later, 1 same year, order not determinable
Zamir_Restormer_Efficient_Transformer_for_High-Resolution_Image_Restoration_CVPR_2022_paper (2022 (year only))
Restormer: Efficient Transformer for High-Resolution Image Restoration
2303.02881 (2023-03)
KBNet: Kernel Basis Network for Image Restoration
2303.11684 (2023-03)
SpikeCV: Open a Continuous Computer Vision Era
and 6 more not named here
calculate_ssim 8 other papers
7 later, 1 same year, order not determinable
Zamir_Restormer_Efficient_Transformer_for_High-Resolution_Image_Restoration_CVPR_2022_paper (2022 (year only))
Restormer: Efficient Transformer for High-Resolution Image Restoration
2303.02881 (2023-03)
KBNet: Kernel Basis Network for Image Restoration
2303.11684 (2023-03)
SpikeCV: Open a Continuous Computer Vision Era
and 5 more not named here
compute_psnr 5 other papers
5 later
2305.12966 (2023-05)
Hierarchical Integration Diffusion Model for Realistic Image Deblurring
2401.00027 (2024-01)
Efficient Multi-scale Network with Learnable Discrete Wavelet Transform for Blind Motion Deblurring
2404.13153 (2024-04)
Motion-adaptive Separable Collaborative Filters for Blind Motion Deblurring
and 2 more not named here
image_align 5 other papers
5 later
2305.12966 (2023-05)
Hierarchical Integration Diffusion Model for Realistic Image Deblurring
2401.00027 (2024-01)
Efficient Multi-scale Network with Learnable Discrete Wavelet Transform for Blind Motion Deblurring
2404.13153 (2024-04)
Motion-adaptive Separable Collaborative Filters for Blind Motion Deblurring
and 2 more not named here
compute_ssim 4 other papers
4 later
2401.00027 (2024-01)
Efficient Multi-scale Network with Learnable Discrete Wavelet Transform for Blind Motion Deblurring
2404.13153 (2024-04)
Motion-adaptive Separable Collaborative Filters for Blind Motion Deblurring
2405.16749 (2024-05)
DMPlug: A Plug-in Method for Solving Inverse Problems with Diffusion Models
and 1 more not named here
block_images_einops
brick of this paper's assembly: helper
1 other paper
1 later
2204.01697 (2022-04)
MaxViT: Multi-Axis Vision Transformer
recover_tree 1 other paper
1 dated earlier
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
unblock_images_einops
brick of this paper's assembly: helper
1 other paper
1 later
2204.01697 (2022-04)
MaxViT: Multi-Axis Vision Transformer

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

Repositories linked to this paper

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

Abstract

Recent progress on Transformers and multi-layer perceptron (MLP) models provide new network architectural designs for computer vision tasks. Although these models proved to be effective in many vision tasks such as image recognition, there remain challenges in adapting them for low-level vision. The inflexibility to support high-resolution images and limitations of local attention are perhaps the main bottlenecks. In this work, we present a multi-axis MLP based architecture called MAXIM, that can serve as an efficient and flexible general-purpose vision backbone for image processing tasks. MAXIM uses a UNet-shaped hierarchical structure and supports long-range interactions enabled by spatially-gated MLPs. Specifically, MAXIM contains two MLP-based building blocks: a multi-axis gated MLP that allows for efficient and scalable spatial mixing of local and global visual cues, and a cross-gating block, an alternative to cross-attention, which accounts for crossfeature conditioning. Both these modules are exclusively based on MLPs, but also benefit from being both global and 'fully-convolutional', two properties that are desirable for image processing. Our extensive experimental results show that the proposed MAXIM model achieves state-ofthe-art performance on more than ten benchmarks across a range of image processing tasks, including denoising, deblurring, deraining, dehazing, and enhancement while requiring fewer or comparable numbers of parameters and FLOPs than competitive models. The source code and trained models will be available at https://github. com/google-research/maxim.

For agents

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

get_harvested_code_for_paper("2201.02973")
get_code_for_paper("2201.02973")
have("2201.02973")

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

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

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

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

Connect an agent — have() is free.