SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2108.10257 · 2021

SwinIR: Image Restoration Using Swin Transformer

arXiv · PDF · Open in the Atlas

Code that ran

30 of 45 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (14 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 16 have no contract verdict; 14 failures of our instrument; 15 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-23; 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/2108.10257.json · badge: /api/ran/2108.10257.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
jingyunliang/swinir canonical (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
pilot7747/sldl application (classifier label)
classifier basis: classifier_2025
10 ran · 2 no recorded run
mv-lab/swin2sr extension (classifier label)
classifier basis: classifier_2025
8 ran · 4 no recorded run
XPixelGroup/BasicSR reimplementation (classifier label)
classifier basis: classifier_2025
7 ran · 5 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
skchen1993/SwinIR reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 2 no recorded run
rami0205/ngramswin extension (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
this paper's copy was not recorded; identical code first harvested from JiaDingCN/GeminiFusion
pointer only · get_code("144d10b49baeb8a6")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Mlp Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("9b7e99667d6f97b5")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_features": 4,
    "hidden_features": 8,
    "out_features": 3,
    "act_layer": nn.GELU,
    "drop": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mlp — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Mlp output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PatchEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("c3d1df420e59f005")
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, PatchEmbed: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from timm.models.layers import to_2tuple

torch.manual_seed(0)

# Build a minimal norm_layer that satisfies the usage in PatchEmbed
class SimpleNorm(nn.Module):
    def __init__(self, dim):
        super().__init__()
        self.norm = nn.LayerNorm(dim)
    
    def forward(self, x):
        return self.norm(x)

ARGS = {
    'img_size': 224,
    'patch_size': 4,
    'in_chans': 3,
    'embed_dim': 96,
    'norm_layer': SimpleNorm
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatchEmbed — 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 PatchEmbed 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
PatchEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("f1109f9b1b73dca7")
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, PatchEmbed: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from timm.models.layers import to_2tuple

torch.manual_seed(0)

ARGS = {
    "img_size": 224,
    "patch_size": 4,
    "in_chans": 3,
    "embed_dim": 96,
    "norm_layer": nn.LayerNorm,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatchEmbed — 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 PatchEmbed 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
PatchUnEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("2d3ebe5f83f401e2")
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, PatchUnEmbed: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from timm.models.layers import to_2tuple

torch.manual_seed(0)

ARGS = {
    "img_size": 224,
    "patch_size": 4,
    "in_chans": 3,
    "embed_dim": 96,
    "norm_layer": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatchUnEmbed — 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 PatchUnEmbed 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
PatchUnEmbed Ran
ran on a synthesized input · constructed an object; no result was computed
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("926e8d276bb28da7")
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, PatchUnEmbed: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from timm.models.layers import to_2tuple

torch.manual_seed(0)

ARGS = {
    'img_size': 224,
    'patch_size': 4,
    'in_chans': 3,
    'embed_dim': 96,
    'norm_layer': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PatchUnEmbed — 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 PatchUnEmbed 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
PatchUnEmbed Ran
ran on a synthesized input
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("1ca0dd483faa6682")
How it ran

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

def _ntuple(n):
    def parse(x):
        if isinstance(x, collections.abc.Iterable):
            return x
        return tuple(repeat(x, n))
    return parse

to_2tuple = _ntuple(2)

class PatchUnEmbed(nn.Module):
    """ Image to Patch Unembedding

    Args:
        img_size (int): Image size.  Default: 224.
        patch_size (int): Patch token size. Default: 4.
        in_chans (int): Number of input image channels. Default: 3.
        embed_dim (int): Number of linear projection output channels. Default: 96.
        norm_layer (nn.Module, optional): Normalization layer. Default: None
    """

    def __init__(self, img_size=224, patch_size=4, in_chans=3, embed_dim=96, norm_layer=None):
        super().__init__()
        img_size = to_2tuple(img_size)
        patch_size = to_2tuple(patch_size)
        patches_resolution = [img_size[0] // patch_size[0], img_size[1] // patch_size[1]]
        self.img_size = img_size
        self.patch_size = patch_size
        self.patches_resolution = patches_resolution
        self.num_patches = patches_resolution[0] * patches_resolution[1]
        self.in_chans = in_chans
        self.embed_dim = embed_dim

    def forward(self, x, x_size):
        x = x.transpose(1, 2).view(x.shape[0], self.embed_dim, x_size[0], x_size[1])
        return x

    def flops(self):
        flops = 0
        return flops


INIT_ARGS = {
    'img_size': 16,
    'patch_size': 4,
    'in_chans': 3,
    'embed_dim': 8,
    'norm_layer': None
}

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

if __name__ == '__main__':
    model = PatchUnEmbed(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: (2, 8, 4, 4)")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 8, 4, 4) — shape (2, 8, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
RSTB Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("83d329df57a93e38")
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, RSTB: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from timm.models.layers import DropPath, to_2tuple, trunc_normal_

torch.manual_seed(0)

# Create a minimal SwinTransformerBlock stand-in since it's referenced but not defined
class SwinTransformerBlock(nn.Module):
    def __init__(self, dim, input_resolution, num_heads, window_size, shift_size, 
                 mlp_ratio=4.0, qkv_bias=True, qk_scale=None, drop=0.0, attn_drop=0.0, 
                 drop_path=0.0, norm_layer=nn.LayerNorm):
        super().__init__()
        self.dim = dim
        self.input_resolution = input_resolution
        self.num_heads = num_heads
        self.window_size = window_size
        self.shift_size = shift_size
        self.norm1 = norm_layer(dim)
        self.norm2 = norm_layer(dim)
        self.mlp = nn.Linear(dim, dim)
        
    def forward(self, x, x_size):
        return x
    
    def flops(self):
        return 0

# Create a minimal Downsample stand-in
class PatchMerging(nn.Module):
    def __init__(self, input_resolution, dim, norm_layer=nn.LayerNorm):
        super().__init__()
        self.input_resolution = input_resolution
        self.dim = dim
        self.reduction = nn.Linear(4 * dim, 2 * dim, bias=False)
        self.norm = norm_layer(4 * dim)
    
    def forward(self, x):
        return self.reduction(self.norm(x))
    
    def flops(self):
        return 0

# Build arguments for BasicLayer
ARGS = {
    'dim': 96,
    'input_resolution': (56, 56),
    'depth': 2,
    'num_heads': 3,
    'window_size': 7,
    'mlp_ratio': 4.0,
    'qkv_bias': True,
    'qk_scale': None,
    'drop': 0.0,
    'attn_drop': 0.0,
    'drop_path': 0.1,
    'norm_layer': nn.LayerNorm,
    'downsample': PatchMerging,
    'use_checkpoint': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RSTB — 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 RSTB 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
RSTB Ran
ran on a synthesized input · constructed an object; no result was computed
skchen1993/SwinIR/models/network_swinir.py
pointer only (licence: NONE) · get_code("c9ad6c972cd89083")
How it ran

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

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

import torch
import torch.nn as nn
from timm.models.layers import DropPath, to_2tuple, trunc_normal_

torch.manual_seed(0)

# Minimal stand-in classes for dependencies

class SwinTransformerBlock(nn.Module):
    def __init__(self, dim, input_resolution, num_heads, window_size, shift_size, mlp_ratio=4.0, qkv_bias=True, qk_scale=None, drop=0.0, attn_drop=0.0, drop_path=0.0, norm_layer=nn.LayerNorm):
        super().__init__()
        self.dim = dim
        self.input_resolution = input_resolution
        self.num_heads = num_heads
        self.window_size = window_size
        self.shift_size = shift_size
        self.norm1 = norm_layer(dim)
        self.norm2 = norm_layer(dim)
        self.attn = nn.Identity()
        self.mlp = nn.Linear(dim, dim)
        self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity()

    def forward(self, x, x_size):
        x = x + self.drop_path(self.attn(self.norm1(x)))
        x = x + self.drop_path(self.mlp(self.norm2(x)))
        return x

    def flops(self):
        return 0


class PatchUnEmbed(nn.Module):
    def __init__(self, img_size, patch_size, in_chans, embed_dim, norm_layer=None):
        super().__init__()
        self.img_size = to_2tuple(img_size)
        self.patch_size = to_2tuple(patch_size)
        self.patches_resolution = [self.img_size[0] // self.patch_size[0], self.img_size[1] // self.patch_size[1]]
        self.num_patches = self.patches_resolution[0] * self.patches_resolution[1]
        self.in_chans = in_chans
        self.embed_dim = embed_dim

    def forward(self, x, x_size):
        return x


class PatchEmbed(nn.Module):
    def __init__(self, img_size=224, patch_size=4, in_chans=3, embed_dim=96, norm_layer=None):
        super().__init__()
        img_size = to_2tuple(img_size)
        patch_size = to_2tuple(patch_size)
        self.patches_resolution = [img_size[0] // patch_size[0], img_size[1] // patch_size[1]]
        self.num_patches = self.patches_resolution[0] * self.patches_resolution[1]
        self.in_chans = in_chans
        self.embed_dim = embed_dim
        self.proj = nn.Linear(in_chans * patch_size[0] * patch_size[1], embed_dim)
        self.norm = norm_layer(embed_dim) if norm_layer is not None else None

    def forward(self, x):
        x = x.flatten(2).transpose(1, 2)
        x = self.proj(x)
        if self.norm is not None:
            x = self.norm(x)
        return x


class Upsample(nn.Module):
    def __init__(self, dim, norm_layer=nn.LayerNorm):
        super().__init__()
        self.conv = nn.Linear(dim, dim * 4)

    def forward(self, x):
        return x

    def flops(self):
        return 0


class UpsampleOneStep(nn.Module):
    def __init__(self, scale, num_feat, norm_layer=nn.LayerNorm):
        super().__init__()
        self.conv = nn.Linear(num_feat, num_feat)

    def forward(self, x):
        return x

    def flops(self):
        return 0


# Construct minimal SwinIR arguments
ARGS = {
    'upscale': 2,
    'img_size': 64,
    'window_size': 8,
    'img_range': 1.0,
    'depths': [2, 2],
    'embed_dim': 4,
    'num_heads': [1, 1],
    'mlp_ratio': 2.0,
    'upsampler': 'pixelshuffle',
    'resi_connection': '1conv',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SwinIR — 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 SwinIR 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
Upsample Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("d4fd867e299aa381")
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, Upsample: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

ARGS = {
    "scale": 2,
    "num_feat": 64,
}
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 Upsample — 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 Upsample output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
UpsampleOneStep Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("66093c479a99786e")
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, UpsampleOneStep: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "scale": 2,
    "num_feat": 64,
    "num_out_ch": 3,
    "input_resolution": torch.Size([32, 32])
}
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 UpsampleOneStep — 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 UpsampleOneStep output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
UpsampleOneStep Ran
ran on a synthesized input · constructed an object; no result was computed
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("ffe7885c0403a8ad")
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, UpsampleOneStep: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "scale": 2,
    "num_feat": 16,
    "num_out_ch": 3,
    "input_resolution": (32, 32),
}
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 UpsampleOneStep — 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 UpsampleOneStep output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Upsample_hf Ran
ran on a synthesized input · constructed an object; no result was computed
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("d32e066d4cc1a4ce")
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, Upsample_hf: 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 math
import torch
import torch.nn as nn

torch.manual_seed(0)

# The Upsample_hf class takes two parameters: scale and num_feat
# scale: int - must be a power of 2 or 3
# num_feat: int - number of channels

ARGS = {
    "scale": 4,  # 2^2, a valid power of 2
    "num_feat": 8,  # number of feature channels
}
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 Upsample_hf — 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 Upsample_hf output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
WindowAttention Ran
ran on a synthesized input · constructed an object; no result was computed
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("6184e406e3b12051")
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, WindowAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "dim": 64,
    "window_size": (7, 7),
    "num_heads": 4,
    "qkv_bias": True,
    "qk_scale": None,
    "attn_drop": 0.0,
    "proj_drop": 0.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type WindowAttention — 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 WindowAttention 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
WindowAttention Ran
ran on a synthesized input · constructed an object; no result was computed
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("0b773949f1dbd046")
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, WindowAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "window_size": (2, 3),
    "num_heads": 2,
    "qkv_bias": True,
    "attn_drop": 0.0,
    "proj_drop": 0.0,
    "pretrained_window_size": [0, 0],
}
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 WindowAttention — 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 WindowAttention 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
WindowAttention Ran
ran on a synthesized input
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("a79acfc7f5245c04")
How it ran

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

import torch
import torch.nn as nn
import math
import warnings

def _no_grad_trunc_normal_(tensor, mean, std, a, b):
    def norm_cdf(x):
        return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0
    if mean < a - 2 * std or mean > b + 2 * std:
        warnings.warn('mean is more than 2 std from [a, b] in nn.init.trunc_normal_. The distribution of values may be incorrect.', stacklevel=2)
    with torch.no_grad():
        low = norm_cdf((a - mean) / std)
        up = norm_cdf((b - mean) / std)
        tensor.uniform_(2 * low - 1, 2 * up - 1)
        tensor.erfinv_()
        tensor.mul_(std * math.sqrt(2.0))
        tensor.add_(mean)
        tensor.clamp_(min=a, max=b)
        return tensor

def trunc_normal_(tensor, mean=0.0, std=1.0, a=-2.0, b=2.0):
    return _no_grad_trunc_normal_(tensor, mean, std, a, b)

class WindowAttention(nn.Module):
    def __init__(self, dim, window_size, num_heads, qkv_bias=True, qk_scale=None, attn_drop=0.0, proj_drop=0.0):
        super().__init__()
        self.dim = dim
        self.window_size = window_size
        self.num_heads = num_heads
        head_dim = dim // num_heads
        self.scale = qk_scale or head_dim ** (-0.5)
        self.relative_position_bias_table = nn.Parameter(torch.zeros((2 * window_size[0] - 1) * (2 * window_size[1] - 1), num_heads))
        coords_h = torch.arange(self.window_size[0])
        coords_w = torch.arange(self.window_size[1])
        coords = torch.stack(torch.meshgrid([coords_h, coords_w], indexing='ij'))
        coords_flatten = torch.flatten(coords, 1)
        relative_coords = coords_flatten[:, :, None] - coords_flatten[:, None, :]
        relative_coords = relative_coords.permute(1, 2, 0).contiguous()
        relative_coords[:, :, 0] += self.window_size[0] - 1
        relative_coords[:, :, 1] += self.window_size[1] - 1
        relative_coords[:, :, 0] *= 2 * self.window_size[1] - 1
        relative_position_index = relative_coords.sum(-1)
        self.register_buffer('relative_position_index', relative_position_index)
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.attn_drop = nn.Dropout(attn_drop)
        self.proj = nn.Linear(dim, dim)
        self.proj_drop = nn.Dropout(proj_drop)
        trunc_normal_(self.relative_position_bias_table, std=0.02)
        self.softmax = nn.Softmax(dim=-1)

    def forward(self, x, mask=None):
        b_, n, c = x.shape
        qkv = self.qkv(x).reshape(b_, n, 3, self.num_heads, c // self.num_heads).permute(2, 0, 3, 1, 4)
        q, k, v = (qkv[0], qkv[1], qkv[2])
        q = q * self.scale
        attn = q @ k.transpose(-2, -1)
        relative_position_bias = self.relative_position_bias_table[self.relative_position_index.view(-1)].view(self.window_size[0] * self.window_size[1], self.window_size[0] * self.window_size[1], -1)
        relative_position_bias = relative_position_bias.permute(2, 0, 1).contiguous()
        attn = attn + relative_position_bias.unsqueeze(0)
        if mask is not None:
            nw = mask.shape[0]
            attn = attn.view(b_ // nw, nw, self.num_heads, n, n) + mask.unsqueeze(1).unsqueeze(0)
            attn = attn.view(-1, self.num_heads, n, n)
            attn = self.softmax(attn)
        else:
            attn = self.softmax(attn)
        attn = self.attn_drop(attn)
        x = (attn @ v).transpose(1, 2).reshape(b_, n, c)
        x = self.proj(x)
        x = self.proj_drop(x)
        return x

INIT_ARGS = {
    'dim': 4,
    'window_size': (2, 3),
    'num_heads': 2,
    'qkv_bias': True,
    'qk_scale': None,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
}

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

if __name__ == '__main__':
    model = WindowAttention(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, f"Shape mismatch: {output.shape} vs {ARGS['x'].shape}"
    print("Test passed!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
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)
_no_grad_trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("c30c007e9c6365e0")
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 Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import math

torch.manual_seed(0)

# Create a small tensor to be initialized
tensor = torch.empty(2, 4)

# Define parameters for truncated normal distribution
mean = 0.0
std = 1.0
a = -2.0  # lower bound
b = 2.0   # upper bound

ARGS = {
    "tensor": tensor,
    "mean": mean,
    "std": std,
    "a": a,
    "b": b,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.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
setup Ran
ran; our contract draft was wrong, not the code
mv-lab/swin2sr/main_test_swin2sr.py
code served (permissive licence) · get_code("c1dd0848500dd803")
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 tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

class Args:
    def __init__(self):
        self.task = 'classical_sr'
        self.scale = 2
        self.save_img_only = False
        self.folder_lq = '/path/to/lq'
        self.folder_gt = '/path/to/gt'
        self.large_model = False
        self.jpeg = 10

args = Args()

ARGS = {'args': args}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
setup Ran
ran; our contract draft was wrong, not the code
jingyunliang/swinir/main_test_swinir.py
code served (permissive licence) · get_code("31b521c272528885")
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 tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

class Args:
    def __init__(self):
        self.task = 'classical_sr'
        self.scale = 2
        self.folder_gt = 'test_folder_gt'
        self.folder_lq = 'test_folder_lq'
        self.large_model = False
        self.noise = 15
        self.jpeg = 40

args = Args()

ARGS = {'args': args}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("0af416f19e3851c1")
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 Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small tensor to be filled with truncated normal values
tensor = torch.empty(2, 4)

# Define arguments for trunc_normal_
ARGS = {
    'tensor': tensor,
    'mean': 0.0,
    'std': 1.0,
    'a': -2.0,
    'b': 2.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: 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)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.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_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("f9fd6241d935f07b")
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)
# B = 2 (batch size)
# H = 8 (height, must be divisible by window_size)
# W = 12 (width, must be divisible by window_size)
# C = 4 (channels)
# window_size = 4

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_partition Ran
ran; our contract draft was wrong, not the code
rami0205/ngramswin/my_model/ngswin_model/win_partition.py
code served (permissive licence) · get_code("2e2b1611530d7466")
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 tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from einops import rearrange

torch.manual_seed(0)

# Create a tensor with shape [B, ph, pw, D]
# B = 2 (batch size)
# ph = 8 (patch height, must be divisible by window_size)
# pw = 12 (patch width, must be divisible by window_size)
# D = 4 (dimension)
# window_size = 4

B = 2
ph = 8
pw = 12
D = 4
window_size = 4

x = torch.randn(B, ph, pw, D)

ARGS = {
    'x': x,
    'window_size': window_size
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("def274ea4faeed8e")
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 (8, 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)

# x should be (B, H, W, C) where:
# - B is batch size
# - H and W are height and width (must be divisible by window_size)
# - C is number of channels
# The function will partition H and W into window_size chunks

B = 2
H = 8
W = 8
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 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 (8, 4, 4, 4) — shape (8, 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
this paper's copy was not recorded; identical code first harvested from JiaDingCN/GeminiFusion
pointer only · get_code("61bf152e6a42a184")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

window_reverse Ran
ran; our contract draft was wrong, not the code
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.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
window_reverse Ran
ran; our contract draft was wrong, not the code
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("fb32094c6dbece71")
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  # 8 // 4 = 2
num_windows_w = W // window_size  # 12 // 4 = 3
num_windows = num_windows_h * num_windows_w  # 2 * 3 = 6

# Total number of windows across batch
total_windows = num_windows * B  # 6 * 2 = 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
window_reverse Ran
ran; our contract draft was wrong, not the code
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("f424ec76ee33ee41")
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

torch.manual_seed(0)

# window_size: the size of each window patch (e.g., 4x4)
window_size = 4

# H, W: height and width of the original image
H = 8
W = 8

# C: number of channels
C = 3

# Calculate num_windows
num_windows = (H // window_size) * (W // window_size)  # (8//4) * (8//4) = 2 * 2 = 4

# B: batch size
B = 2

# windows shape: (num_windows*B, window_size, window_size, C)
# = (4*2, 4, 4, 3) = (8, 4, 4, 3)
windows = torch.randn(num_windows * B, window_size, window_size, C)

ARGS = {
    "windows": windows,
    "window_size": window_size,
    "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
BasicLayer Not yet run
unverified (harvested, no recorded run)
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("b8c4b72467b45853")
How it ran

no invocation recorded.

BasicLayer Not yet run
unverified (harvested, no recorded run)
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("4b45c8b3f6e06e21")
How it ran

no invocation recorded.

BasicLayer Not yet run
unverified (harvested, no recorded run)
skchen1993/SwinIR/models/network_swinir.py
pointer only (licence: NONE) · get_code("c0fa116516c7281e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, skchen1993/SwinIR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

BasicLayer Not yet run
unverified (harvested, no recorded run)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("b03980f33707e7ed")
How it ran

no invocation recorded.

PatchEmbed Not yet run
unverified (harvested, no recorded run)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("0ad2bdf7da7fee45")
How it ran

no invocation recorded.

RSTB Not yet run
unverified (harvested, no recorded run)
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("5b79ebccea629915")
How it ran

no invocation recorded.

RSTB Not yet run
unverified (harvested, no recorded run)
jingyunliang/swinir/models/network_swinir.py
code served (permissive licence) · get_code("13721b7fb0c3449e")
How it ran

no invocation recorded.

RSTB Not yet run
unverified (harvested, no recorded run)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("f56a662c7641524f")
How it ran

no invocation recorded.

Swin2SR Not yet run
unverified (harvested, no recorded run)
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("eeeeae50440c5756")
How it ran

no invocation recorded.

SwinIR Not yet run
unverified (harvested, no recorded run)
skchen1993/SwinIR/models/network_swinir.py
pointer only (licence: NONE) · get_code("d59939ffe142f76f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, skchen1993/SwinIR when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

SwinIR Not yet run
unverified (harvested, no recorded run)
jingyunliang/swinir/models/network_swinir.py
code served (permissive licence) · get_code("a8c3f25f547b1cd4")
How it ran

no invocation recorded.

SwinIR Not yet run
unverified (harvested, no recorded run)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("b6fd49729a87480e")
How it ran

no invocation recorded.

SwinTransformerBlock Not yet run
unverified (harvested, no recorded run)
pilot7747/sldl/sldl/image/swinir.py
code served (permissive licence) · get_code("21b564ba0365248a")
How it ran

no invocation recorded.

SwinTransformerBlock Not yet run
unverified (harvested, no recorded run)
mv-lab/swin2sr/models/network_swin2sr.py
code served (permissive licence) · get_code("f09171fe10737272")
How it ran

no invocation recorded.

SwinTransformerBlock Not yet run
unverified (harvested, no recorded run)
XPixelGroup/BasicSR/basicsr/archs/swinir_arch.py
code served (permissive licence) · get_code("16d322e629d07ccc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 45 samples lifted from this paper's linked repositories, 45 carry a function identity and 0 do not. Of the 41 distinct functions with an identity, 17 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 1 the same month, 17 later) and 24 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
window_reverse
brick of this paper's assembly: helper
227 other papers
15 dated earlier, 212 later · 34 only as an assembly brick
1608.03983 (2016-08)
SGDR: Stochastic Gradient Descent with Warm Restarts
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 224 more not named here
drop_path
brick of this paper's assembly: helper
224 other papers
9 dated earlier, 2 the same month, 212 later, 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
window_partition
brick of this paper's assembly: helper
223 other papers
15 dated earlier, 208 later · 32 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1711.10925 (2017-11)
Deep Image Prior
2003.13678 (2020-03)
Designing Network Design Spaces
and 220 more not named here
trunc_normal_
brick of this paper's assembly: helper
160 other papers
9 dated earlier, 151 later · 36 only as an assembly brick
1911.10194 (2019-11)
Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation
2005.10242 (2020-05)
Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere
2007.12911 (2020-07)
Tighter risk certificates for neural networks
and 157 more not named here
window_partition
brick of this paper's assembly: helper
12 other papers
12 later · 1 only as an assembly brick
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
2302.03453 (2023-02)
OSRT: Omnidirectional Image Super-Resolution with Distortion-aware Transformer
and 9 more not named here
window_reverse
brick of this paper's assembly: helper
11 other papers
11 later · 1 only as an assembly brick
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
2302.03453 (2023-02)
OSRT: Omnidirectional Image Super-Resolution with Distortion-aware Transformer
and 8 more not named here
PatchUnEmbed
brick of this paper's assembly: helper, model
5 other papers
5 later · 2 only as an assembly brick
2203.13963 (2022-03)
Transformer-empowered Multi-scale Contextual Matching and Aggregation for Multi-contrast MRI Super-resolution
2304.03994 (2023-04)
RIDCP: Revitalizing Real Image Dehazing via High-Quality Codebook Priors
2310.01840 (2023-10)
Self-Supervised High Dynamic Range Imaging with Multi-Exposure Images in Dynamic Scenes
and 2 more not named here
PatchEmbed
brick of this paper's assembly: helper
2 other papers
2 later
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
2210.01427 (2022-10)
Accurate Image Restoration with Attention Retractable Transformer
PatchUnEmbed
brick of this paper's assembly: helper
2 other papers
2 later
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
2210.01427 (2022-10)
Accurate Image Restoration with Attention Retractable Transformer
RSTB
brick of this paper's assembly: helper, model
2 other papers
2 later
2304.03994 (2023-04)
RIDCP: Revitalizing Real Image Dehazing via High-Quality Codebook Priors
2503.13147 (2025-03)
Iterative Predictor-Critic Code Decoding for Real-World Image Dehazing
BasicLayer
brick of this paper's assembly: helper
1 other paper
1 later
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
PatchEmbed
brick of this paper's assembly: model
1 other paper
1 later
2205.00434 (2022-05)
Reinforced Swin-Convs Transformer for Underwater Image Enhancement
RSTB
brick of this paper's assembly: helper
1 other paper
1 later
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
SwinTransformerBlock
brick of this paper's assembly: helper
1 other paper
1 later
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
WindowAttention
brick of this paper's assembly: helper
1 other paper
1 later
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
setup 1 other paper
1 later
2606.30821 (2026-06)
Mind the Residual Gap: Probabilistic Downscaling under Real-World Bias
window_partition 1 other paper
1 later
2211.11436 (2022-11)
N-Gram in Swin Transformers for Efficient Lightweight Image Super-Resolution

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-23.

Repositories linked to this paper

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

Abstract

Image restoration is a long-standing low-level vision problem that aims to restore high-quality images from low-quality images (e.g., downscaled, noisy and compressed images). While state-of-the-art image restoration methods are based on convolutional neural networks, few attempts have been made with Transformers which show impressive performance on high-level vision tasks. In this paper, we propose a strong baseline model SwinIR for image restoration based on the Swin Transformer. SwinIR consists of three parts: shallow feature extraction, deep feature extraction and high-quality image reconstruction. In particular, the deep feature extraction module is composed of several residual Swin Transformer blocks (RSTB), each of which has several Swin Transformer layers together with a residual connection. We conduct experiments on three representative tasks: image super-resolution (including classical, lightweight and real-world image super-resolution), image denoising (including grayscale and color image denoising) and JPEG compression artifact reduction. Experimental results demonstrate that SwinIR outperforms state-of-the-art methods on different tasks by $\textbf{up to 0.14$\sim$0.45dB}$, while the total number of parameters can be reduced by $\textbf{up to 67%}$.

For agents

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

get_harvested_code_for_paper("2108.10257")
get_code_for_paper("2108.10257")
have("2108.10257")

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

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

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

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

Connect an agent — have() is free.