SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.06373 · ICLR · 2024

Recursive Generalization Transformer for Image Super-Resolution

Yulun Zhang, Xiaokang Yang, Jinjin Gu, Linghe Kong, Zheng Chen, L Mlp, Hai Hai, L Layer, Normalization Mlp, Multilayer Perceptron

arXiv · PDF · Open in the Atlas

Code that ran

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

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2303.06373.json · badge: /api/ran/2303.06373.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/RGT canonical (classifier label)
classifier basis not recorded on the link
11 ran · 1 no recorded run
FunctionStatusWhere it lives
flow_warp Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/archs/arch_util.py
code served (permissive licence) · get_code("ef9faf68f492a375")
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 4, dtype family float, shape (2, 4, 3, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small image/feature map tensor: (batch=2, channels=4, height=3, width=5)
x = torch.randn(2, 4, 3, 5)

# Create optical flow tensor: (batch=2, height=3, width=5, 2)
# The flow represents displacement in (x, y) directions
flow = torch.randn(2, 3, 5, 2) * 0.5  # Small displacements

ARGS = {
    'x': x,
    'flow': flow,
    'interp_mode': 'bilinear',
    'padding_mode': 'zeros',
    'align_corners': True,
}
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 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 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
get_position_from_periods Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhengchen1999/RGT/basicsr/models/lr_scheduler.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from AlifAshrafee/Restoring-Without-Forgetting, is pointer only (licence: NONE) · get_code("cd569444547de84f")
How it ran

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

img2windows Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhengchen1999/RGT/basicsr/archs/rgt_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
insert_bn Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/archs/vgg_arch.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Jiayi-Fu/IPC-Dehaze, is pointer only (licence: NOASSERTION) · get_code("5360d45b71ae2bb1")
How it ran

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

make_layer Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/archs/arch_util.py
code served (permissive licence) · get_code("96ad5dc9ca239aec")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a simple basic block that can be instantiated with **kwarg
class SimpleBasicBlock(nn.Module):
    def __init__(self, in_channels=3, out_channels=4):
        super().__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)
    
    def forward(self, x):
        return self.conv(x)

# Construct the arguments
ARGS = {
    'basic_block': SimpleBasicBlock,
    'num_basic_block': 3,
    'in_channels': 3,
    'out_channels': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
master_only Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/utils/dist_util.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from xpixelgroup/seal, is pointer only (licence: NONE) · get_code("f6b0e1eb5b7df3e3")
How it ran

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

reduce_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhengchen1999/RGT/basicsr/losses/loss_util.py
code served (permissive licence) · get_code("a648a03a952822c0")
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 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small elementwise loss tensor (batch=2, elements=4)
loss = torch.tensor([[0.5, 1.2, 0.3, 0.8], [0.9, 0.4, 1.1, 0.6]], dtype=torch.float32)

# Test with 'mean' reduction
reduction = 'mean'

ARGS = {
    'loss': loss,
    'reduction': reduction,
}
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 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
reorder_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zhengchen1999/RGT/basicsr/metrics/metric_util.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from AlifAshrafee/Restoring-Without-Forgetting, is pointer only (licence: NONE) · get_code("95067518dc16b3e5")
How it ran

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

resize_flow Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/archs/arch_util.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from JiaxiaoWang/EvReflection, is pointer only (licence: NONE) · get_code("5a1d8458dc7077a6")
How it ran

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

weight_reduce_loss Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/losses/loss_util.py
code served (permissive licence) · get_code("1ba39317ea81871a")
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 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small loss tensor (batch_size=2, num_elements=4)
loss = torch.rand(2, 4)

# Create a weight tensor with matching dimensions
# weight.dim() == loss.dim() and weight.size(1) == loss.size(1)
weight = torch.rand(2, 4)

# Test different reduction modes
reduction = 'mean'

ARGS = {
    'loss': loss,
    'weight': weight,
    'reduction': reduction
}
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 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
windows2img Ran
ran; our contract draft was wrong, not the code
zhengchen1999/RGT/basicsr/archs/rgt_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
weighted_loss Not yet run
unverified (harvested, no recorded run)
zhengchen1999/RGT/basicsr/losses/loss_util.py
code served (permissive licence) · get_code("cf63f8afc13f62a7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 12 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 5 the same month, 12 later) and 0 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
get_position_from_periods 55 other papers
5 dated earlier, 3 the same month, 45 later, 2 same year, order not determinable
2110.04627 (2021-10)
Vector-quantized Image Modeling with Improved VQGAN
136790177 (2022 (year only))
Frequency and Spatial Dual Guidance for Image Dehazing
2204.04676 (2022-04)
Simple Baselines for Image Restoration
and 52 more not named here
weighted_loss 44 other papers
5 dated earlier, 2 the same month, 34 later, 3 same year, order not determinable
136790177 (2022 (year only))
Frequency and Spatial Dual Guidance for Image Dehazing
2203.14216 (2022-03)
Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution
2205.05996 (2022-05)
Blueprint Separable Residual Network for Efficient Image Super-Resolution
and 41 more not named here
reduce_loss 43 other papers
5 dated earlier, 2 the same month, 34 later, 2 same year, order not determinable
136790177 (2022 (year only))
Frequency and Spatial Dual Guidance for Image Dehazing
2203.14216 (2022-03)
Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution
2205.05996 (2022-05)
Blueprint Separable Residual Network for Efficient Image Super-Resolution
and 40 more not named here
weight_reduce_loss 43 other papers
5 dated earlier, 2 the same month, 33 later, 3 same year, order not determinable
136790177 (2022 (year only))
Frequency and Spatial Dual Guidance for Image Dehazing
2203.14216 (2022-03)
Efficient and Degradation-Adaptive Network for Real-World Image Super-Resolution
2205.05996 (2022-05)
Blueprint Separable Residual Network for Efficient Image Super-Resolution
and 40 more not named here
make_layer 29 other papers
2 dated earlier, 26 later, 1 same year, order not determinable
2107.10833 (2021-07)
Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data
2108.11048 (2021-08)
Memory-Augmented Non-Local Attention for Video Super-Resolution
and 26 more not named here
flow_warp 25 other papers
1 dated earlier, 23 later, 1 same year, order not determinable · 1 only as an assembly brick
2107.10833 (2021-07)
Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data
2308.03364 (2023-08)
Dual Aggregation Transformer for Image Super-Resolution
and 22 more not named here
resize_flow 21 other papers
1 dated earlier, 19 later, 1 same year, order not determinable
2107.10833 (2021-07)
Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data
2308.03364 (2023-08)
Dual Aggregation Transformer for Image Super-Resolution
and 18 more not named here
reorder_image 17 other papers
1 dated earlier, 15 later, 1 same year, order not determinable
2204.04676 (2022-04)
Simple Baselines for Image Restoration
2308.03364 (2023-08)
Dual Aggregation Transformer for Image Super-Resolution
and 14 more not named here
img2windows 14 other papers
3 dated earlier, 11 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
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
windows2img 14 other papers
3 dated earlier, 11 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
2211.13654 (2022-11)
Cross Aggregation Transformer for Image Restoration
and 11 more not named here
insert_bn 12 other papers
1 the same month, 11 later · 3 only as an assembly brick
2303.00748 (2023-03)
Efficient and Explicit Modelling of Image Hierarchies for Image Restoration
2304.03994 (2023-04)
RIDCP: Revitalizing Real Image Dehazing via High-Quality Codebook Priors
2308.03262 (2023-08)
A Benchmark for Chinese-English Scene Text Image Super-resolution
and 9 more not named here
master_only 9 other papers
2 dated earlier, 6 later, 1 same year, order not determinable
2105.12085 (2021-05)
DSANet: Dynamic Segment Aggregation Network for Video-Level Representation Learning
2110.04627 (2021-10)
Vector-quantized Image Modeling with Improved VQGAN
and 6 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-22.

Repositories linked to this paper

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

Abstract

Transformer architectures have exhibited remarkable performance in image superresolution (SR). Since the quadratic computational complexity of the selfattention (SA) in Transformer, existing methods tend to adopt SA in a local region to reduce overheads. However, the local design restricts the global context exploitation, which is crucial for accurate image reconstruction. In this work, we propose the Recursive Generalization Transformer (RGT) for image SR, which can capture global spatial information and is suitable for high-resolution images. Specifically, we propose the recursive-generalization self-attention (RG-SA). It recursively aggregates input features into representative feature maps, and then utilizes cross-attention to extract global information. Meanwhile, the channel dimensions of attention matrices (query, key, and value) are further scaled to mitigate the redundancy in the channel domain. Furthermore, we combine the RG-SA with local self-attention to enhance the exploitation of the global context, and propose the hybrid adaptive integration (HAI) for module integration. The HAI allows the direct and effective fusion between features at different levels (local or global). Extensive experiments demonstrate that our RGT outperforms recent state-of-the-art methods quantitatively and qualitatively. Code and pre-trained models are available at https://github.com/zhengchen1999/RGT.

For agents

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

get_harvested_code_for_paper("2303.06373")
get_code_for_paper("2303.06373")
have("2303.06373")

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

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

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

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

Connect an agent — have() is free.