SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.15648 · ECCV · 2024

MambaIR: A Simple Baseline for Image Restoration with State-Space Model

Shu-Tao Xia, Hang Guo, Tao Dai, Xudong Ren, Zhihao Ouyang, Jinmin Li

arXiv · PDF · Open in the Atlas

Code that ran

14 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 6 failures of our instrument; 1 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/2402.15648.json · badge: /api/ran/2402.15648.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
csguoh/MambaIR canonical (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
iridescentttt/SynQT community
Papers with Code archive
6 ran · 1 no recorded run
FunctionStatusWhere it lives
Adapter Ran
ran on a synthesized input
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("bb483d1dc27ae6fd")
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, 768) 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 Mlp(nn.Module):
    """ MLP as used in Vision Transformer, MLP-Mixer and related networks
    """

    def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0):
        super().__init__()
        out_features = out_features or in_features
        hidden_features = hidden_features or in_features
        self.fc1 = nn.Linear(in_features, hidden_features)
        self.act = act_layer()
        self.fc2 = nn.Linear(hidden_features, out_features)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        return x

class Adapter(nn.Module):

    def __init__(self, hidden=64, drop=0.1):
        super().__init__()
        self.mlp = Mlp(768, hidden, 768, nn.GELU, drop)

    def forward(self, x):
        return x + self.mlp(x)


INIT_ARGS = {
    'hidden': 32,
    'drop': 0.1,
}

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

if __name__ == '__main__':
    adapter = Adapter(**INIT_ARGS)
    output = adapter(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, "Output 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 2, dtype family float, shape (2, 768) — shape (2, 768) 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)
ConditionCombineBlock Ran
ran on a synthesized input
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("ab54423c3b962f1c")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

class Mlp1(nn.Module):

    def __init__(self, in_features=768, out_features=768, act_layer=nn.GELU, drop=0.1):
        super().__init__()
        self.fc1 = nn.Linear(in_features, out_features)
        self.act = act_layer()
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        return x

class ConditionCombineBlock(nn.Module):

    def __init__(self, dim):
        super().__init__()
        self.dim = dim
        self.get_weight = Mlp1(768, self.dim - 1)
        self.act = nn.Tanh()
        self.weight = nn.Parameter(torch.ones(self.dim))

    def forward(self, feat):
        bs, layers = feat.shape[:2]
        weight = self.get_weight(feat[:, 0]).view(bs, -1)
        weight = self.act(weight)
        cls_weight = torch.ones(bs, 1).cuda()
        weight = torch.cat([cls_weight, weight], dim=1)
        return torch.mean(weight.view(bs, layers, 1) * feat, dim=1)


INIT_ARGS = {
    'dim': 4
}

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

if __name__ == '__main__':
    model = ConditionCombineBlock(**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 — 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 Ran
ran on a synthesized input
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("cef8b4a7bdc3ecd8")
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, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

class Mlp(nn.Module):
    """ MLP as used in Vision Transformer, MLP-Mixer and related networks
    """

    def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0):
        super().__init__()
        out_features = out_features or in_features
        hidden_features = hidden_features or in_features
        self.fc1 = nn.Linear(in_features, hidden_features)
        self.act = act_layer()
        self.fc2 = nn.Linear(hidden_features, out_features)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        return x


INIT_ARGS = {
    'in_features': 4,
    'hidden_features': 8,
    'out_features': 3,
    'act_layer': nn.GELU,
    'drop': 0.1,
}

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

if __name__ == '__main__':
    mlp = Mlp(**INIT_ARGS)
    output = mlp(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3)")
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, 3) — shape (2, 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)
Mlp1 Ran
ran on a synthesized input
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("e406ec263d8983d2")
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, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

class Mlp1(nn.Module):

    def __init__(self, in_features=768, out_features=768, act_layer=nn.GELU, drop=0.1):
        super().__init__()
        self.fc1 = nn.Linear(in_features, out_features)
        self.act = act_layer()
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        return x


INIT_ARGS = {
    'in_features': 4,
    'out_features': 3,
    'act_layer': nn.GELU,
    'drop': 0.1,
}

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

if __name__ == '__main__':
    model = Mlp1(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3)")
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, 3) — shape (2, 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)
QSMAttention Ran
ran on a synthesized input
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("bba4a43c8f71523d")
How it ran

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

import torch
from torch import nn

class Mlp(nn.Module):
    """ MLP as used in Vision Transformer, MLP-Mixer and related networks
    """

    def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0):
        super().__init__()
        out_features = out_features or in_features
        hidden_features = hidden_features or in_features
        self.fc1 = nn.Linear(in_features, hidden_features)
        self.act = act_layer()
        self.fc2 = nn.Linear(hidden_features, out_features)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        return x

class Adapter(nn.Module):

    def __init__(self, hidden=64, drop=0.1):
        super().__init__()
        self.mlp = Mlp(768, hidden, 768, nn.GELU, drop)

    def forward(self, x):
        return x + self.mlp(x)

class QSMAttention(nn.Module):

    def __init__(self, attn_scale, drop=0.1):
        super().__init__()
        self.scale = 768 ** (-0.5)
        self.q_proj = Adapter(8, 0)
        self.k_proj = Adapter(8, 0)
        self.v_proj = Adapter(8, 0)
        self.proj = Adapter(8, 0)
        self.feat_drop = nn.Dropout(drop)
        self.attn_drop = nn.Dropout(drop)
        self.proj_drop = nn.Dropout(drop)
        self.q_norm = nn.LayerNorm(768)
        self.kv_norm = nn.LayerNorm(768)
        self.token_mask_ratio = drop

    def forward(self, prompt):
        prompt_len = prompt.shape[1]
        norm_prompt = self.q_norm(prompt)
        norm_ref_feat = self.kv_norm(prompt)
        q = self.q_proj(norm_prompt)
        k = self.k_proj(norm_ref_feat)
        v = self.v_proj(norm_ref_feat)
        attn = q @ k.transpose(-2, -1) * self.scale
        attn = attn.softmax(dim=-1)
        attn = self.attn_drop(attn)
        x = attn @ v
        x = self.proj(x)
        x = self.proj_drop(x)
        prompt = x[:, :prompt_len]
        return prompt

INIT_ARGS = {
    'attn_scale': 1.0,
    'drop': 0.1
}

ARGS = {
    'prompt': torch.randn(2, 3, 768)
}

if __name__ == '__main__':
    model = QSMAttention(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 3, 768)")
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 — 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)
QSMBlock Ran
ran on a synthesized input
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("d643bf97deee36bb")
How it ran

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

import torch
from torch import nn

class Adapter(nn.Module):

    def __init__(self, hidden=64, drop=0.1):
        super().__init__()
        self.mlp = Mlp(768, hidden, 768, nn.GELU, drop)

    def forward(self, x):
        return x + self.mlp(x)

class Mlp(nn.Module):
    """ MLP as used in Vision Transformer, MLP-Mixer and related networks
    """

    def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0):
        super().__init__()
        out_features = out_features or in_features
        hidden_features = hidden_features or in_features
        self.fc1 = nn.Linear(in_features, hidden_features)
        self.act = act_layer()
        self.fc2 = nn.Linear(hidden_features, out_features)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x = self.fc1(x)
        x = self.act(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        return x

class QSMAttention(nn.Module):

    def __init__(self, attn_scale, drop=0.1):
        super().__init__()
        self.scale = 768 ** (-0.5)
        self.q_proj = Adapter(8, 0)
        self.k_proj = Adapter(8, 0)
        self.v_proj = Adapter(8, 0)
        self.proj = Adapter(8, 0)
        self.feat_drop = nn.Dropout(drop)
        self.attn_drop = nn.Dropout(drop)
        self.proj_drop = nn.Dropout(drop)
        self.q_norm = nn.LayerNorm(768)
        self.kv_norm = nn.LayerNorm(768)
        self.token_mask_ratio = drop

    def forward(self, prompt):
        prompt_len = prompt.shape[1]
        norm_prompt = self.q_norm(prompt)
        norm_ref_feat = self.kv_norm(prompt)
        q = self.q_proj(norm_prompt)
        k = self.k_proj(norm_ref_feat)
        v = self.v_proj(norm_ref_feat)
        attn = q @ k.transpose(-2, -1) * self.scale
        attn = attn.softmax(dim=-1)
        attn = self.attn_drop(attn)
        x = attn @ v
        x = self.proj(x)
        x = self.proj_drop(x)
        prompt = x[:, :prompt_len]
        return prompt

class QSMBlock(nn.Module):

    def __init__(self, attn_scale=0.1, ffn_scale=0.1, drop=0.1):
        super().__init__()
        self.attn = QSMAttention(attn_scale, drop=drop)
        self.mlp = Adapter(48, 0.1)
        self.norm1 = nn.LayerNorm(768)
        self.norm2 = nn.LayerNorm(768)
        self.attn_scale = nn.Parameter(torch.ones(1) * attn_scale)
        self.ffn_scale = nn.Parameter(torch.ones(1) * ffn_scale)

    def forward(self, x):
        x = x + self.attn(self.norm1(x)) * self.attn_scale
        x = x + self.mlp(self.norm2(x)) * self.ffn_scale
        return x


INIT_ARGS = {
    'attn_scale': 0.1,
    'ffn_scale': 0.1,
    'drop': 0.1,
}

ARGS = {
    'x': torch.randn(2, 3, 768),
}
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 — 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)
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csguoh/MambaIR/analysis/model_zoo/hat.py
code served (permissive licence) · get_code("52d96aa31ed74a56")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 4, 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

torch.manual_seed(0)

# Create a small tensor with batch size 2 and some feature dimensions
# Shape: (batch=2, channels=3, height=4, width=5) to have distinct dimensions
x = torch.randn(2, 3, 4, 5)

# drop_prob: probability of dropping a path (between 0 and 1)
drop_prob = 0.2

# training: boolean flag indicating if we're in training mode
training = True

ARGS = {
    'x': x,
    'drop_prob': drop_prob,
    'training': training
}
Setup block drafted by
a language model, Claude Sonnet 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 Tensor, ndim 4, dtype family float, shape (2, 3, 4, 5) — shape (2, 3, 4, 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
flops_selective_scan_fn Ran
ran, honoured the contract we drafted
csguoh/MambaIR/analysis/utils_fvcore.py
code served (permissive licence) · get_code("5f390d616fb142ad")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Analyzing the function:
# - B: batch size (int)
# - L: sequence length (int)
# - D: hidden dimension (int)
# - N: state dimension (int)
# - with_D: boolean flag
# - with_Z: boolean flag
# - with_complex: boolean flag (must be False)

# The function only uses these parameters in arithmetic operations,
# so we just need to provide valid integer and boolean values.

ARGS = {
    "B": 2,
    "L": 256,
    "D": 768,
    "N": 16,
    "with_D": True,
    "with_Z": False,
    "with_complex": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
flops_selective_scan_ref Ran
ran, honoured the contract we drafted
csguoh/MambaIR/analysis/utils_fvcore.py
code served (permissive licence) · get_code("0b84e99fd1e93dd6")
How it ran

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

import numpy as np

# ARGS dict for flops_selective_scan_ref
ARGS = {
    'B': 2,
    'L': 256,
    'D': 768,
    'N': 16,
    'with_D': True,
    'with_Z': False,
    'with_Group': True,
    'with_complex': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
img2windows Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csguoh/MambaIR/analysis/model_zoo/cat.py
code served (permissive licence) · get_code("15c613ecceb6aa71")
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 3, dtype family float, shape (16, 6, 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

torch.manual_seed(0)

# Create a small image tensor with shape (B, C, H, W)
# Using distinct sizes: B=2, C=4, H=8, W=6
img = torch.randn(2, 4, 8, 6)

# H_sp and W_sp are spatial partition sizes
# They must divide H and W evenly
# H=8, so H_sp can be 2, 4, or 8. Using H_sp=2
# W=6, so W_sp can be 2, 3, or 6. Using W_sp=3
H_sp = 2
W_sp = 3

ARGS = {
    "img": img,
    "H_sp": H_sp,
    "W_sp": W_sp,
}
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 Tensor, ndim 3, dtype family float, shape (16, 6, 4) — shape (16, 6, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
import_abspy Ran
ran; our contract draft was wrong, not the code
csguoh/MambaIR/analysis/utils_fvcore.py
code served (permissive licence) · get_code("e582f87a53fb23d4")
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 module. 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 os
import sys
import tempfile
import importlib.util

# Create a temporary directory structure with a minimal module
temp_dir = tempfile.mkdtemp()
module_dir = os.path.join(temp_dir, 'classification')
os.makedirs(module_dir, exist_ok=True)

# Create a minimal 'models' module
models_file = os.path.join(module_dir, 'models.py')
with open(models_file, 'w') as f:
    f.write("# Minimal models module\nDUMMY_VAR = 42\n")

# Create __init__.py to make it a package
init_file = os.path.join(module_dir, '__init__.py')
with open(init_file, 'w') as f:
    f.write("")

ARGS = {
    'name': 'models',
    'path': module_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type module — a module output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a module 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
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
csguoh/MambaIR/analysis/model_zoo/hat.py
code served (permissive licence) · get_code("60363d0620f5778d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (12, 4, 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 torch

torch.manual_seed(0)

# Create a tensor with shape (b, h, w, c)
# h and w must be divisible by window_size
# Using distinct dimensions: b=2, h=8, w=12, c=4
# window_size=4 divides both h and w

b = 2
h = 8
w = 12
c = 4
window_size = 4

x = torch.randn(b, h, w, c)

ARGS = {
    'x': x,
    'window_size': window_size
}
Setup block drafted by
a language model, Claude Sonnet 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 Tensor, ndim 4, dtype family float, shape (12, 4, 4, 4) — shape (12, 4, 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: none by the harness; any seed is in the setup block
window_reverse Ran
ran; our contract draft was wrong, not the code
csguoh/MambaIR/analysis/model_zoo/hat.py
code served (permissive licence) · get_code("4f003e9ad9b7a7cb")
How it ran

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

import torch

torch.manual_seed(0)

# Define parameters
# We need windows of shape (num_windows*b, window_size, window_size, c)
# where num_windows = (h/window_size) * (w/window_size)

b = 2
h = 8
w = 12
window_size = 4
c = 6

# Calculate num_windows
num_windows_h = h // window_size  # 2
num_windows_w = w // window_size  # 3
num_windows = num_windows_h * num_windows_w  # 6

# Total number of windows across batch
total_windows = num_windows * b  # 12

# Create windows tensor
windows = torch.randn(total_windows, window_size, window_size, c)

ARGS = {
    'windows': windows,
    'window_size': window_size,
    'h': h,
    'w': w
}
Setup block drafted by
a language model, Claude Sonnet 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 Tensor, ndim 4, dtype family float, shape (2, 8, 12, 6) — shape (2, 8, 12, 6) 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
windows2img Ran
ran; our contract draft was wrong, not the code
csguoh/MambaIR/analysis/model_zoo/cat.py
code served (permissive licence) · get_code("8cb23a62748d3b1c")
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, 8, 8, 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 torch.nn as nn

torch.manual_seed(0)

# Understand the function:
# - img_splits_hw: tensor of shape (B', N, C) where B' = B * (H/H_sp) * (W/W_sp)
# - H_sp, W_sp: spatial dimensions of each window
# - H, W: full image height and width
# - Returns reconstructed image of shape (B, H, W, C)

# Let's set concrete values:
# B = 2 (batch size)
# H = 8, W = 8 (full image dimensions)
# H_sp = 4, W_sp = 4 (window/patch dimensions)
# C = 3 (channels)

B = 2
H = 8
W = 8
H_sp = 4
W_sp = 4
C = 3

# Calculate B' (number of patches per batch)
# B' = B * (H/H_sp) * (W/W_sp) = 2 * (8/4) * (8/4) = 2 * 2 * 2 = 8
B_prime = B * (H // H_sp) * (W // W_sp)

# img_splits_hw shape: (B', N, C)
# where N = H_sp * W_sp = 4 * 4 = 16
N = H_sp * W_sp
img_splits_hw = torch.randn(B_prime, N, C)

ARGS = {
    "img_splits_hw": img_splits_hw,
    "H_sp": H_sp,
    "W_sp": W_sp,
    "H": H,
    "W": W,
}
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 Tensor, ndim 4, dtype family float, shape (2, 8, 8, 3) — shape (2, 8, 8, 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
SynQT Not yet run
unverified (harvested, no recorded run)
iridescentttt/SynQT/synqt.py
code served (permissive licence) · get_code("76fe1ca9c7cf2ce4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 9 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 2 the same month, 9 later) and 6 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
drop_path 224 other papers
147 dated earlier, 2 the same month, 67 later, 7 same year, order not determinable, 1 undated · 38 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2007.09384 (2020-07)
Multi-Scale Positive Sample Refinement for Few-Shot Object Detection
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
and 221 more not named here
Mlp
brick of this paper's assembly: helper
130 other papers
92 dated earlier, 3 the same month, 35 later · 114 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2012.12877 (2020-12)
Training data-efficient image transformers & distillation through attention
and 127 more not named here
img2windows 14 other papers
7 dated earlier, 6 later, 1 same year, order not determinable · 1 only as an assembly brick
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2208.08630 (2022-08)
Unifying Visual Perception by Dispersible Points Learning
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
windows2img 14 other papers
7 dated earlier, 6 later, 1 same year, order not determinable · 1 only as an assembly brick
2107.00652 (2021-07)
CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows
2208.08630 (2022-08)
Unifying Visual Perception by Dispersible Points Learning
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
flops_selective_scan_fn 12 other papers
1 dated earlier, 11 later
2401.10166 (2024-01)
VMamba: Visual State Space Model
2403.17839 (2024-03)
ReMamber: Referring Image Segmentation with Mamba Twister
2404.02668 (2024-04)
RS-Mamba for Large Remote Sensing Image Dense Prediction
and 9 more not named here
window_partition 12 other papers
8 dated earlier, 4 later · 1 only as an assembly brick
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
and 9 more not named here
window_reverse 11 other papers
8 dated earlier, 3 later · 1 only as an assembly brick
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
and 8 more not named here
flops_selective_scan_ref 9 other papers
1 dated earlier, 8 later
2401.10166 (2024-01)
VMamba: Visual State Space Model
2403.09977 (2024-03)
EfficientVMamba: Atrous Selective Scan for Light Weight Visual Mamba
2403.17839 (2024-03)
ReMamber: Referring Image Segmentation with Mamba Twister
and 6 more not named here
import_abspy 1 other paper
1 later
2411.15269 (2024-11)
MambaIRv2: Attentive State Space Restoration

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 years have seen significant advancements in image restoration, largely attributed to the development of modern deep neural networks, such as CNNs and Transformers. However, existing restoration backbones often face the dilemma between global receptive fields and efficient computation, hindering their application in practice. Recently, the Selective Structured State Space Model, especially the improved version Mamba, has shown great potential for long-range dependency modeling with linear complexity, which offers a way to resolve the above dilemma. However, the standard Mamba still faces certain challenges in low-level vision such as local pixel forgetting and channel redundancy. In this work, we introduce a simple but effective baseline, named MambaIR, which introduces both local enhancement and channel attention to improve the vanilla Mamba. In this way, our MambaIR takes advantage of the local pixel similarity and reduces the channel redundancy. Extensive experiments demonstrate the superiority of our method, for example, MambaIR outperforms SwinIR by up to 0.45dB on image SR, using similar computational cost but with a global receptive field. Code is available at https://github.com/csguoh/MambaIR.

For agents

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

get_harvested_code_for_paper("2402.15648")
get_code_for_paper("2402.15648")
have("2402.15648")

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

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

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

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

Connect an agent — have() is free.