SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2211.13654 · NeurIPS · 2022

Cross Aggregation Transformer for Image Restoration

Xin Yuan, Yulun Zhang, Jinjin Gu, Yongbing Zhang, Linghe Kong, Zheng Chen

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 2 failures of our instrument; 4 no recorded run), 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/2211.13654.json · badge: /api/ran/2211.13654.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
zhengchen1999/cat canonical (classifier label)
classifier basis: classifier_2025
7 ran · 4 no recorded run
FunctionStatusWhere it lives
Attention_axial Ran
ran on a synthesized input · constructed an object; no result was computed
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("9fcd98d2097453fd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Attention_axial: 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)

# Create minimal valid arguments for Attention_axial.__init__
ARGS = {
    'dim': 16,
    'resolution': 32,
    'idx': 0,
    'split_size': 7,
    'dim_out': 16,
    'num_heads': 4,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
    'qk_scale': None,
    'position_bias': True,
}
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 Attention_axial — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Attention_axial output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Attention_regular Ran
ran on a synthesized input · constructed an object; no result was computed
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("69065b697deb15e0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Attention_regular: 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,
    'resolution': 32,
    'idx': 0,
    'split_size': [8, 16],
    'dim_out': 64,
    'num_heads': 4,
    'attn_drop': 0.1,
    'proj_drop': 0.1,
    'qk_scale': None,
    'position_bias': True,
}
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 Attention_regular — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Attention_regular 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
DynamicPosBias Ran
ran on a synthesized input · constructed an object; no result was computed
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("705379c0ebcadf0a")
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, DynamicPosBias: 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": 16,
    "num_heads": 4,
    "residual": True,
}
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 DynamicPosBias — 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 DynamicPosBias 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
Registry Ran
ran on a synthesized input · constructed an object; no result was computed
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("2cd4dd2a6360b684")
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, Registry: 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.

class Registry:
    """
    The registry that provides name -> object mapping, to support third-party
    users' custom modules.

    To create a registry (e.g. a backbone registry):

    .. code-block:: python

        BACKBONE_REGISTRY = Registry('BACKBONE')

    To register an object:

    .. code-block:: python

        @BACKBONE_REGISTRY.register()
        class MyBackbone():
            ...

    Or:

    .. code-block:: python

        BACKBONE_REGISTRY.register(MyBackbone)
    """

    def __init__(self, name):
        """
        Args:
            name (str): the name of this registry
        """
        self._name = name
        self._obj_map = {}

    def _do_register(self, name, obj):
        assert name not in self._obj_map, f"An object named '{name}' was already registered in '{self._name}' registry!"
        self._obj_map[name] = obj

    def register(self, obj=None):
        """
        Register the given object under the the name `obj.__name__`.
        Can be used as either a decorator or not.
        See docstring of this class for usage.
        """
        if obj is None:

            def deco(func_or_class):
                name = func_or_class.__name__
                self._do_register(name, func_or_class)
                return func_or_class
            return deco
        name = obj.__name__
        self._do_register(name, obj)

    def get(self, name):
        ret = self._obj_map.get(name)
        if ret is None:
            raise KeyError(f"No object named '{name}' found in '{self._name}' registry!")
        return ret

    def __contains__(self, name):
        return name in self._obj_map

    def __iter__(self):
        return iter(self._obj_map.items())

    def keys(self):
        return self._obj_map.keys()


# Setup code to construct valid arguments for Registry.__init__
ARGS = {
    'name': 'BACKBONE'
}
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 Registry — 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 Registry 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
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("eaa574d0bc3bf779")
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
img2windows Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhengchen1999/cat/basicsr/archs/cat_arch.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
windows2img Ran
ran; our contract draft was wrong, not the code
zhengchen1999/cat/basicsr/archs/cat_arch.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
CAT Not yet run
unverified (harvested, no recorded run)
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("b1d288dec78999a4")
How it ran

no invocation recorded.

CATB_axial Not yet run
unverified (harvested, no recorded run)
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("022d78e3cb045a68")
How it ran

no invocation recorded.

CATB_regular Not yet run
unverified (harvested, no recorded run)
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("4f917d55d2a0051e")
How it ran

no invocation recorded.

ResidualGroup Not yet run
unverified (harvested, no recorded run)
zhengchen1999/cat/basicsr/archs/cat_arch.py
code served (permissive licence) · get_code("6064f631b5d071d2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 5 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 5 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
img2windows
brick of this paper's assembly: helper
14 other papers
2 dated earlier, 12 later · 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
2303.06373 (2023-03)
Recursive Generalization Transformer for Image Super-Resolution
and 11 more not named here
windows2img
brick of this paper's assembly: helper
14 other papers
2 dated earlier, 12 later · 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
2303.06373 (2023-03)
Recursive Generalization Transformer for Image Super-Resolution
and 11 more not named here
Registry
brick of this paper's assembly: helper
11 other papers
4 dated earlier, 7 later · 10 only as an assembly brick
2202.03373 (2022-02)
LEDNet: Joint Low-light Enhancement and Deblurring in the Dark
2203.07319 (2022-03)
GCFSR: a Generative and Controllable Face Super Resolution Method Without Facial and GAN Priors
2205.06803 (2022-05)
VQFR: Blind Face Restoration with Vector-Quantized Dictionary and Parallel Decoder
and 8 more not named here
Upsample
brick of this paper's assembly: helper
10 other papers
5 dated earlier, 5 later · 7 only as an assembly brick
2103.14030 (2021-03)
Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2111.12341 (2021-11)
EvDistill: Asynchronous Events to End-task Learning via Bidirectional Reconstruction-guided Cross-modal Knowledge Distillation
and 7 more not named here
DynamicPosBias
brick of this paper's assembly: helper
4 other papers
4 later · 3 only as an assembly brick
2308.03364 (2023-08)
Dual Aggregation Transformer for Image Super-Resolution
2403.01598 (2024-03)
APISR: Anime Production Inspired Real-World Anime Super-Resolution
2405.07648 (2024-05)
CDFormer: When Degradation Prediction Embraces Diffusion Model for Blind Image Super-Resolution
and 1 more not named here

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

Recently, Transformer architecture has been introduced into image restoration to replace convolution neural network (CNN) with surprising results. Considering the high computational complexity of Transformer with global attention, some methods use the local square window to limit the scope of self-attention. However, these methods lack direct interaction among different windows, which limits the establishment of long-range dependencies. To address the above issue, we propose a new image restoration model, Cross Aggregation Transformer (CAT). The core of our CAT is the Rectangle-Window Self-Attention (Rwin-SA), which utilizes horizontal and vertical rectangle window attention in different heads parallelly to expand the attention area and aggregate the features cross different windows. We also introduce the Axial-Shift operation for different window interactions. Furthermore, we propose the Locality Complementary Module to complement the self-attention mechanism, which incorporates the inductive bias of CNN (e.g., translation invariance and locality) into Transformer, enabling global-local coupling. Extensive experiments demonstrate that our CAT outperforms recent state-of-theart methods on several image restoration applications. The code and models are available at https://github.com/zhengchen1999/CAT.

For agents

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

get_harvested_code_for_paper("2211.13654")
get_code_for_paper("2211.13654")
have("2211.13654")

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

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

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

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

Connect an agent — have() is free.