SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.09895 · 2021

Posterior Sampling for Image Restoration using Explicit Patch Priors

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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; 5 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/2104.09895.json · badge: /api/ran/2104.09895.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
friedmanroy/torchEPLL canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
BiCGSTAB Ran
ran; our contract draft was wrong, not the code
friedmanroy/torchEPLL/EPLL/solvers.py
code served (permissive licence) · get_code("8bdc57246e968fc5")
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 1, dtype family float, shape (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 as tp
import numpy as np

tp.manual_seed(0)

# Create a small system to solve: Ax = b
# We'll use a simple 4x4 matrix A and a vector b of size 4
A_matrix = tp.tensor([
    [4.0, 1.0, 0.0, 0.5],
    [1.0, 3.0, 0.5, 0.0],
    [0.0, 0.5, 2.0, 1.0],
    [0.5, 0.0, 1.0, 3.0]
], dtype=tp.float32)

b_vector = tp.tensor([1.0, 2.0, 3.0, 4.0], dtype=tp.float32)

x0_vector = tp.zeros(4, dtype=tp.float32)

# Test with tensor A
ARGS = {
    "A": A_matrix,
    "b": b_vector,
    "x0": x0_vector,
    "precision": 1e-6,
    "max_its": 5000
}
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 Tensor, ndim 1, dtype family float, shape (4,) — shape (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
conjgrad Ran
ran; our contract draft was wrong, not the code
friedmanroy/torchEPLL/EPLL/solvers.py
code served (permissive licence) · get_code("ca740ff5461abf3e")
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 1, dtype family float, shape (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 as tp
import numpy as np

tp.manual_seed(0)

# Create a small positive-definite matrix for A
# Using a simple 4x4 symmetric positive-definite matrix
A_matrix = tp.tensor([
    [4.0, 1.0, 0.5, 0.2],
    [1.0, 3.0, 0.3, 0.1],
    [0.5, 0.3, 2.0, 0.4],
    [0.2, 0.1, 0.4, 1.5]
])

# Create b vector
b = tp.tensor([1.0, 2.0, 3.0, 4.0])

# Create initial guess x0
x0 = tp.tensor([0.1, 0.1, 0.1, 0.1])

# Create a callable version of A for testing
def A_callable(x):
    return A_matrix @ x

ARGS = {
    "A": A_matrix,
    "b": b,
    "x0": x0,
    "precision": 1e-6,
    "max_its": 5000
}
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 Tensor, ndim 1, dtype family float, shape (4,) — shape (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
pad_im Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
friedmanroy/torchEPLL/EPLL/EPLL_utils.py
code served (permissive licence) · get_code("ff4e7efd1f8265e3")
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 (6, 7) 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 as tp
import numpy as np

tp.manual_seed(0)

# Create a small 2D image tensor (grayscale)
im_2d = tp.randn(4, 5)

# Create a small 3D image tensor (with 3 channels)
im_3d = tp.randn(4, 5, 3)

# Test with 2D tensor
ARGS = {
    'im': im_2d,
    'p_sz': 2,
    'mode': 'reflect',
    'end_values': 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 Tensor, ndim 2, dtype family float, shape (6, 7) — shape (6, 7) 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
to_patches Ran
ran; our contract draft was wrong, not the code
friedmanroy/torchEPLL/EPLL/EPLL_utils.py
code served (permissive licence) · get_code("ddb785d19d4fc2d9")
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 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 as tp

tp.manual_seed(0)

# Create a small grayscale image (4x6 tensor)
im_grayscale = tp.randn(4, 6)

# Create a small color image (4x6x3 tensor)
im_color = tp.randn(4, 6, 3)

# Test with grayscale image
ARGS = {
    "im": im_grayscale,
    "p_sz": 2,
    "x0": 0,
    "y0": 0,
}
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 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
trim_im Ran
ran; our contract draft was wrong, not the code
friedmanroy/torchEPLL/EPLL/EPLL_utils.py
code served (permissive licence) · get_code("e73f53ca4c9d4a9c")
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 (0, 1, 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 as tp

tp.manual_seed(0)

# Create a small test image tensor
# The function indexes with [p_sz // 2:-p_sz // 2] on both dimensions
# So we need an image with at least 2 spatial dimensions
# Shape: (batch, channels, height, width) = (2, 3, 8, 8)
im = tp.randn(2, 3, 8, 8)

# p_sz is used for slicing: p_sz // 2:-p_sz // 2
# Using p_sz = 2 will slice [1:-1] on each dimension
p_sz = 2

ARGS = {
    "im": im,
    "p_sz": p_sz,
}
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 (0, 1, 8, 8) — shape (0, 1, 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
hamilMC Not yet run
unverified (harvested, no recorded run)
friedmanroy/torchEPLL/EPLL/solvers.py
code served (permissive licence) · get_code("f6d0e8b56deeefa3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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

Almost all existing methods for image restoration are based on optimizing the mean squared error (MSE), even though it is known that the best estimate in terms of MSE may yield a highly atypical image due to the fact that there are many plausible restorations for a given noisy image. In this paper, we show how to combine explicit priors on patches of natural images in order to sample from the posterior probability of a full image given a degraded image. We prove that our algorithm generates correct samples from the distribution $p(x|y) \propto \exp(-E(x|y))$ where $E(x|y)$ is the cost function minimized in previous patch-based approaches that compute a single restoration. Unlike previous approaches that computed a single restoration using MAP or MMSE, our method makes explicit the uncertainty in the restored images and guarantees that all patches in the restored images will be typical given the patch prior. Unlike previous approaches that used implicit priors on fixed-size images, our approach can be used with images of any size. Our experimental results show that posterior sampling using patch priors yields images of high perceptual quality and high PSNR on a range of challenging image restoration problems.

For agents

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

get_harvested_code_for_paper("2104.09895")
get_code_for_paper("2104.09895")
have("2104.09895")

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

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

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

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

Connect an agent — have() is free.