SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.01497 · 2024

Learning A Physical-aware Diffusion Model Based on Transformer for Underwater Image Enhancement

arXiv · PDF · Open in the Atlas

Code that ran

12 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 7 failures of our instrument; 3 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/2403.01497.json · badge: /api/ran/2403.01497.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
chenydong/pa-diff canonical (classifier label)
classifier basis: census
12 ran · 3 no recorded run
FunctionStatusWhere it lives
calculate_psnr Ran
ran, honoured the contract we drafted
chenydong/pa-diff/core/metrics.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from redrock303/ADF-LLIE, is pointer only (licence: NONE) · get_code("9394ff2c25b8a988")
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 redrock303/ADF-LLIE, 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.

default Ran
ran, violated the contract we drafted
chenydong/pa-diff/model/ddpm_trans_modules/diffusion.py
code served (permissive licence) · get_code("fbf9ec7be545688e")
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 str. 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 numpy as np
from inspect import isfunction

torch.manual_seed(0)

# Test case 1: val exists (not None), d is a regular value
val_case1 = 42
d_case1 = 100

# Test case 2: val is None, d is a regular value
val_case2 = None
d_case2 = "default_string"

# Test case 3: val is None, d is a function
val_case3 = None
def d_case3():
    return [1, 2, 3]

# Test case 4: val exists, d is a function (function should not be called)
val_case4 = torch.tensor([1.0, 2.0, 3.0])
def d_case4():
    return torch.tensor([4.0, 5.0, 6.0])

# We'll use case 2 for the main ARGS
ARGS = {
    'val': None,
    'd': "default_value"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
default_conv Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/model/ddpm_trans_modules/PPU.py
code served (permissive licence) · get_code("7e1f7c581619b800")
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 Conv2d. 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 torch import nn

torch.manual_seed(0)

ARGS = {
    "in_channels": 3,
    "out_channels": 64,
    "kernel_size": 3,
    "bias": 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 Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
dict2str Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/core/logger.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from liyuantsao/BFSR, is pointer only (licence: NONE) · get_code("40c52ad98161c17b")
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 liyuantsao/BFSR, 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.

dict_to_nonedict Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/core/logger.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from liyuantsao/BFSR, is pointer only (licence: NONE) · get_code("ada7273eee7081c7")
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 liyuantsao/BFSR, 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.

exists Ran
ran, violated the contract we drafted
chenydong/pa-diff/model/ddpm_trans_modules/diffusion.py
code served (permissive licence) · get_code("608e364a9d2376a3")
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 bool, 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

def exists(x):
    return x is not None

ARGS = {
    "x": torch.tensor([1, 2, 3, 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 bool, 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
gram_matrix Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/model/ddpm_trans_modules/style_transfer.py
code served (permissive licence) · get_code("91325ea11845812d")
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 2, dtype family float, shape (8, 8) 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)

# The function expects a 4D tensor (b, c, h, w)
# Create a small tensor with distinct dimensions for clarity
# batch=2, channels=4, height=3, width=5
input_tensor = torch.randn(2, 4, 3, 5)

ARGS = {
    "input": input_tensor
}
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 2, dtype family float, shape (8, 8) — shape (8, 8) 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
load_part_of_model Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/model/utils.py
code served (permissive licence) · get_code("1855446869c2370c")
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 NewModel. 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 tempfile
import os

torch.manual_seed(0)

# Create a simple source model and save it
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1 = nn.Linear(4, 3)
        self.layer2 = nn.Linear(3, 2)
    
    def forward(self, x):
        return self.layer2(self.layer1(x))

# Create source model with state dict
src_model = SimpleModel()
src_state = src_model.state_dict()

# Save to temporary file
with tempfile.NamedTemporaryFile(delete=False, suffix='.pt') as f:
    temp_path = f.name
    torch.save(src_state, temp_path)

# Create a new model (target) with compatible architecture
class NewModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1 = nn.Linear(4, 3)
        self.layer2 = nn.Linear(3, 2)
    
    def forward(self, x):
        return self.layer2(self.layer1(x))

new_model = NewModel()

ARGS = {
    'new_model': new_model,
    'src_model_path': temp_path,
    's': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NewModel — a NewModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NewModel 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
load_part_of_model2 Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/model/utils.py
code served (permissive licence) · get_code("bdbc72e56312023e")
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 SimpleModel. 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 tempfile
import os

torch.manual_seed(0)

# Create a simple model to use as new_model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1 = nn.Linear(4, 3)
        self.layer2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.layer1(x)
        x = self.layer2(x)
        return x

# Create a source model state dict with denoise_fn prefix
src_state_dict = {
    'denoise_fn.layer1.weight': torch.randn(3, 4),
    'denoise_fn.layer1.bias': torch.randn(3),
    'denoise_fn.layer2.weight': torch.randn(2, 3),
    'denoise_fn.layer2.bias': torch.randn(2),
    'denoise_fn.extra_layer.weight': torch.randn(5, 5),  # This won't match
}

# Save the source model state dict to a temporary file
temp_dir = tempfile.gettempdir()
src_model_path = os.path.join(temp_dir, 'src_model_test.pt')
torch.save(src_state_dict, src_model_path)

# Create new_model instance
new_model = SimpleModel()

ARGS = {
    'new_model': new_model,
    'src_model_path': src_model_path,
}
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 SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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
make_beta_schedule Ran
ran, honoured the contract we drafted
chenydong/pa-diff/model/ddpm_trans_modules/diffusion.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from lshaw8317/mlmcfordms, is pointer only (licence: NONE) · get_code("90be2f67f3d453d7")
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 lshaw8317/mlmcfordms, 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.

ssim Ran
ran, honoured the contract we drafted
chenydong/pa-diff/core/metrics.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("ba721aeacc165234")
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.

tensor2img Ran
ran; our contract draft was wrong, not the code
chenydong/pa-diff/core/metrics.py
code served (permissive licence) · get_code("34c878feb7966d4c")
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 ndarray, ndim 3, dtype family int, shape (14, 7, 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 numpy as np

torch.manual_seed(0)

# Create a 4D tensor (B, C, H, W) with batch size 2, 3 channels, 4x3 spatial dims
tensor_4d = torch.randn(2, 3, 4, 3) * 2 - 1  # Range approximately (-1, 1)

ARGS = {
    'tensor': tensor_4d,
    'out_type': np.uint8,
    'min_max': (-1, 1)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (14, 7, 3) — shape (14, 7, 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
define_G Not yet run
unverified (harvested, no recorded run)
chenydong/pa-diff/model/networks.py
code served (permissive licence) · get_code("25a6a47b93887187")
How it ran

no invocation recorded.

np_to_pil Not yet run
unverified (harvested, no recorded run)
chenydong/pa-diff/model/utils.py
code served (permissive licence) · get_code("9ded097b1ff97516")
How it ran

no invocation recorded.

parse Not yet run
unverified (harvested, no recorded run)
chenydong/pa-diff/core/logger.py
code served (permissive licence) · get_code("7ab62e92dd308cad")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 9 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 4 the same month, 9 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
default 207 other papers
130 dated earlier, 9 the same month, 62 later, 6 same year, order not determinable · 41 only as an assembly brick
1711.11585 (2017-11)
High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2010.08162 (2020-10)
SidechainNet: An All-Atom Protein Structure Dataset for Machine Learning
and 204 more not named here
exists 144 other papers
73 dated earlier, 5 the same month, 61 later, 5 same year, order not determinable · 40 only as an assembly brick
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1711.11585 (2017-11)
High-Resolution Image Synthesis and Semantic Manipulation with Conditional GANs
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
and 141 more not named here
default_conv 57 other papers
39 dated earlier, 15 later, 3 same year, order not determinable · 2 only as an assembly brick
1707.02921 (2017-07)
Enhanced Deep Residual Networks for Single Image Super-Resolution
1803.02735 (2018-03)
Deep Back-Projection Networks For Super-Resolution
1803.04626 (2018-03)
Maintaining Natural Image Statistics with the Contextual Loss
and 54 more not named here
dict2str 23 other papers
18 dated earlier, 1 the same month, 3 later, 1 same year, order not determinable
1905.02716 (2019-05)
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
1907.03222 (2019-07)
IRNet: A General Purpose Deep Residual Regression Framework for Materials Discovery
2005.05650 (2020-05)
Invertible Image Rescaling
and 20 more not named here
dict_to_nonedict 19 other papers
14 dated earlier, 1 the same month, 3 later, 1 same year, order not determinable
1609.04802 (2016-09)
Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
1905.02716 (2019-05)
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
2006.14200 (2020-06)
SRFlow: Learning the Super-Resolution Space with Normalizing Flow
and 16 more not named here
ssim 18 other papers
13 dated earlier, 5 later
1809.00219 (2018-09)
ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks
1904.03377 (2019-04)
Blind Super-Resolution With Iterative Kernel Correction
2005.05650 (2020-05)
Invertible Image Rescaling
and 15 more not named here
calculate_psnr 16 other papers
11 dated earlier, 5 later
1809.00219 (2018-09)
ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks
1904.03377 (2019-04)
Blind Super-Resolution With Iterative Kernel Correction
1905.02716 (2019-05)
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
and 13 more not named here
make_beta_schedule 10 other papers
9 dated earlier, 1 later · 3 only as an assembly brick
2104.07636 (2021-04)
Image Super-Resolution via Iterative Refinement
2202.00512 (2022-02)
PROGRESSIVE DISTILLATION FOR FAST SAMPLING OF DIFFUSION MODELS
2206.11892 (2022-06)
DDPM-CD: Denoising Diffusion Probabilistic Models as Feature Extractors for Change Detection
and 7 more not named here
tensor2img 5 other papers
4 dated earlier, 1 later
2206.11892 (2022-06)
DDPM-CD: Denoising Diffusion Probabilistic Models as Feature Extractors for Change Detection
2208.11284 (2022-08)
AT-DDPM: Restoring Faces degraded by Atmospheric Turbulence using Denoising Diffusion Probabilistic Models
2304.01994 (2023-04)
Waving Goodbye to Low-Res: A Diffusion-Wavelet Approach for Image Super-Resolution
and 2 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

Underwater visuals undergo various complex degradations, inevitably influencing the efficiency of underwater vision tasks. Recently, diffusion models were employed to underwater image enhancement (UIE) tasks, and gained SOTA performance. However, these methods fail to consider the physical properties and underwater imaging mechanisms in the diffusion process, limiting information completion capacity of diffusion models. In this paper, we introduce a novel UIE framework, named PA-Diff, designed to exploiting the knowledge of physics to guide the diffusion process. PA-Diff consists of Physics Prior Generation (PPG) Branch, Implicit Neural Reconstruction (INR) Branch, and Physics-aware Diffusion Transformer (PDT) Branch. Our designed PPG branch aims to produce the prior knowledge of physics. With utilizing the physics prior knowledge to guide the diffusion process, PDT branch can obtain underwater-aware ability and model the complex distribution in real-world underwater scenes. INR Branch can learn robust feature representations from diverse underwater image via implicit neural representation, which reduces the difficulty of restoration for PDT branch. Extensive experiments prove that our method achieves best performance on UIE tasks.

For agents

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

get_harvested_code_for_paper("2403.01497")
get_code_for_paper("2403.01497")
have("2403.01497")

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

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

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

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

Connect an agent — have() is free.