SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.05239 · 2023

HAT: Hybrid Attention Transformer for Image Restoration

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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; 3 failures of our instrument; 0 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/2309.05239.json · badge: /api/ran/2309.05239.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
chxy95/hat canonical (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
chxy95/hat/hat/archs/hat_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
window_partition Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
chxy95/hat/hat/archs/hat_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_reverse Ran
ran; our contract draft was wrong, not the code
chxy95/hat/hat/archs/hat_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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 1 the same month, 3 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
drop_path 224 other papers
110 dated earlier, 6 the same month, 101 later, 6 same year, order not determinable, 1 undated · 38 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2007.09384 (2020-07)
Multi-Scale Positive Sample Refinement for Few-Shot Object Detection
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
and 221 more not named here
window_partition 12 other papers
4 dated earlier, 7 later, 1 same year, order not determinable · 1 only as an assembly brick
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
and 9 more not named here
window_reverse 11 other papers
4 dated earlier, 6 later, 1 same year, order not determinable · 1 only as an assembly brick
2108.10257 (2021-08)
SwinIR: Image Restoration Using Swin Transformer
2203.11589 (2022-03)
Adaptive Patch Exiting for Scalable Single Image Super-Resolution
and 8 more not named here

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-based methods have shown impressive performance in image restoration tasks, such as image super-resolution and denoising. However, we find that these networks can only utilize a limited spatial range of input information through attribution analysis. This implies that the potential of Transformer is still not fully exploited in existing networks. In order to activate more input pixels for better restoration, we propose a new Hybrid Attention Transformer (HAT). It combines both channel attention and window-based self-attention schemes, thus making use of their complementary advantages. Moreover, to better aggregate the cross-window information, we introduce an overlapping cross-attention module to enhance the interaction between neighboring window features. In the training stage, we additionally adopt a same-task pre-training strategy to further exploit the potential of the model for further improvement. Extensive experiments have demonstrated the effectiveness of the proposed modules. We further scale up the model to show that the performance of the SR task can be greatly improved. Besides, we extend HAT to more image restoration applications, including real-world image super-resolution, Gaussian image denoising and image compression artifacts reduction. Experiments on benchmark and real-world datasets demonstrate that our HAT achieves state-of-the-art performance both quantitatively and qualitatively. Codes and models are publicly available at https://github.com/XPixelGroup/HAT.

For agents

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

get_harvested_code_for_paper("2309.05239")
get_code_for_paper("2309.05239")
have("2309.05239")

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

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

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

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

Connect an agent — have() is free.