SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.03686 · ICML · 2025

Variational Control for Guidance in Diffusion Models

Stephan Mandt, Theofanis Karaletsos, Felix Draxler, Kushagra Pandey, Farrin Sofian

arXiv · PDF · Open in the Atlas

Code that ran

25 of 37 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (15 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 2 violated it and 15 have no contract verdict; 6 failures of our instrument; 12 no recorded run), measured 2026-11-24; 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/2502.03686.json · badge: /api/ran/2502.03686.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
czi-ai/oc-guidance canonical (classifier label)
classifier basis: classifier_2025
25 ran · 12 no recorded run
FunctionStatusWhere it lives
ClassifierGuidanceModel Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("d462c80071bba6ae")
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, ClassifierGuidanceModel: 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 torch.nn.functional as F
from omegaconf import DictConfig

torch.manual_seed(0)

# Small stand-in model that takes (xt, t, y) and returns tensor with at least 3 channels
class StandInModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4 + 1 + 5, 8)  # xt(4) + t(1) + y(5 classes) -> 8 features
    
    def forward(self, xt, t, y=None):
        batch_size = xt.shape[0]
        t_embed = t.float().unsqueeze(-1)  # (batch, 1)
        
        if y is not None:
            y_onehot = F.one_hot(y.long(), num_classes=5).float()  # (batch, 5)
            combined = torch.cat([xt.view(batch_size, -1), t_embed, y_onehot], dim=-1)
        else:
            combined = torch.cat([xt.view(batch_size, -1), t_embed], dim=-1)
        
        # Pad to match expected input
        if combined.shape[-1] < 10:
            combined = F.pad(combined, (0, 10 - combined.shape[-1]))
        
        out = self.linear(combined[:, :10])  # (batch, 8)
        # Return tensor with at least 3 channels, shape (batch, 8, 1, 1) or (batch, 3+, ...)
        return out.unsqueeze(-1).unsqueeze(-1)  # (batch, 8, 1, 1)

# Small classifier that takes (xt, t) and returns logits
class StandInClassifier(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4 + 1, 5)  # xt(4) + t(1) -> 5 classes
    
    def forward(self, xt, t):
        batch_size = xt.shape[0]
        t_embed = t.float().unsqueeze(-1)  # (batch, 1)
        combined = torch.cat([xt.view(batch_size, -1), t_embed], dim=-1)
        return self.linear(combined)  # (batch, 5)

# Stand-in diffusion object with alpha method
class StandInDiffusion:
    def alpha(self, t):
        # Return alpha values for timestep t
        return torch.ones_like(t).float() * 0.9

# Create config
cfg = DictConfig({
    "model": {
        "class_cond": True
    },
    "classifier": {
        "classifier_scale": 0.5
    }
})

# Create instances
model = StandInModel()
classifier = StandInClassifier()
diffusion = StandInDiffusion()

ARGS = {
    "model": model,
    "classifier": classifier,
    "diffusion": diffusion,
    "cfg": cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
omegaconf, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ClassifierGuidanceModel — 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 ClassifierGuidanceModel 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
Colorization Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("6a6a65fc42a70109")
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, Colorization: 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

torch.manual_seed(0)

# The Colorization class expects:
# - img_dim: int, the image dimension (e.g., 4 for a 4x4 image)
# - device: torch.device, the device to place tensors on

ARGS = {
    "img_dim": 4,
    "device": torch.device("cpu")
}
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 Colorization — 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 Colorization 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
Compose Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("4e17b94f063c1a90")
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, Compose: 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)

class MockH(nn.Module):
    """Mock H_functions implementation for testing Compose"""
    
    def __init__(self, channels=3, img_dim=4):
        super().__init__()
        self.channels = channels
        self.img_dim = img_dim
        self.batch_size = 2
        self.data_dim = channels * img_dim * img_dim
        
        # Create small SVD components
        self._U = torch.randn(self.batch_size, self.data_dim, 5)
        self._V = torch.randn(self.batch_size, self.data_dim, 5)
        self._singulars = torch.tensor([2.0, 1.5, 1.0, 0.5, 0.1])
        
    def set_indices(self, idx):
        pass
    
    def V(self, vec):
        # vec shape: (batch, ...)
        # output shape: (batch, data_dim)
        batch = vec.shape[0]
        return torch.randn(batch, self.data_dim)
    
    def Vt(self, vec):
        # vec shape: (batch, data_dim)
        # output shape: (batch, small_dim)
        batch = vec.shape[0]
        return torch.randn(batch, 5)
    
    def U(self, vec):
        # vec shape: (batch, small_dim)
        # output shape: (batch, data_dim)
        batch = vec.shape[0]
        return torch.randn(batch, self.data_dim)
    
    def Ut(self, vec):
        # vec shape: (batch, data_dim)
        # output shape: (batch, small_dim)
        batch = vec.shape[0]
        return torch.randn(batch, 5)
    
    def singulars(self):
        # output shape: (small_dim,)
        return self._singulars
    
    def add_zeros(self, vec):
        # vec shape: (batch, small_dim)
        # output shape: (batch, data_dim)
        batch = vec.shape[0]
        return torch.randn(batch, self.data_dim)
    
    def H(self, vec):
        # vec shape: (batch, channels, img_dim, img_dim)
        batch = vec.shape[0]
        return torch.randn(batch, self.data_dim)
    
    def H_pinv(self, vec):
        batch = vec.shape[0]
        return torch.randn(batch, self.data_dim)


# Create a list of MockH instances for composition
h1 = MockH(channels=3, img_dim=4)
h2 = MockH(channels=3, img_dim=4)

# Build the Hs list
Hs = [h1, h2]

# Create the ARGS dictionary
ARGS = {
    "Hs": Hs
}
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 Compose — 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 Compose 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
Deblurring Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("71af7ce3212d9e1c")
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, Deblurring: 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

torch.manual_seed(0)

# Create a simple kernel for the deblurring operation
kernel = torch.tensor([0.2, 0.6, 0.2], dtype=torch.float32)

# Parameters for Deblurring
channels = 3
img_dim = 4
device = 'cpu'

ARGS = {
    'kernel': kernel,
    'channels': channels,
    'img_dim': img_dim,
    'device': device
}
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 Deblurring — 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 Deblurring 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
Denoising Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("e305d10182891cee")
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, Denoising: 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

torch.manual_seed(0)

ARGS = {
    "channels": 3,
    "img_dim": 4,
    "device": torch.device("cpu")
}
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 Denoising — 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 Denoising 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
HDR Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("b306e3c609ef54b2")
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, HDR: 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

torch.manual_seed(0)

class HDR:
    """
    A concrete implementation of H_functions for testing.
    """
    
    def __init__(self):
        pass
    
    def H(self, image):
        x = image
        x = torch.clip(x / 0.5, -1, 1)
        return x
    
    def H_pinv(self, x):
        return x * 0.5


ARGS = {}
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 HDR — 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 HDR 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
H_functions Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("6db82769d2740ade")
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, H_functions: 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)

class ConcreteH_functions:
    """
    Concrete implementation of H_functions for testing.
    H is a matrix that can be decomposed as H = U @ diag(singulars) @ Vt
    """
    def __init__(self):
        # Create a small matrix H with known SVD
        # Let's use batch_size=2, data_dim=4, latent_dim=3
        self.batch_size = 2
        self.data_dim = 4
        self.latent_dim = 3
        
        # Create U (batch, data_dim, latent_dim) - orthogonal-like
        self._U = torch.randn(self.batch_size, self.data_dim, self.latent_dim)
        # Normalize columns
        self._U = self._U / (torch.norm(self._U, dim=1, keepdim=True) + 1e-8)
        
        # Create V (batch, data_dim, latent_dim) - orthogonal-like
        self._V = torch.randn(self.batch_size, self.data_dim, self.latent_dim)
        # Normalize columns
        self._V = self._V / (torch.norm(self._V, dim=1, keepdim=True) + 1e-8)
        
        # Create singular values (batch, latent_dim)
        self._singulars = torch.abs(torch.randn(self.batch_size, self.latent_dim)) + 0.1
    
    def V(self, vec):
        """Multiplies input by V: (batch, latent_dim) -> (batch, data_dim)"""
        # vec shape: (batch, latent_dim), output: (batch, data_dim)
        return torch.bmm(vec.unsqueeze(1), self._V.transpose(1, 2)).squeeze(1)
    
    def Vt(self, vec):
        """Multiplies input by V^T: (batch, data_dim) -> (batch, latent_dim)"""
        # vec shape: (batch, data_dim), output: (batch, latent_dim)
        return torch.bmm(vec.unsqueeze(1), self._V).squeeze(1)
    
    def U(self, vec):
        """Multiplies input by U: (batch, latent_dim) -> (batch, data_dim)"""
        # vec shape: (batch, latent_dim), output: (batch, data_dim)
        return torch.bmm(vec.unsqueeze(1), self._U.transpose(1, 2)).squeeze(1)
    
    def Ut(self, vec):
        """Multiplies input by U^T: (batch, data_dim) -> (batch, latent_dim)"""
        # vec shape: (batch, data_dim), output: (batch, latent_dim)
        return torch.bmm(vec.unsqueeze(1), self._U).squeeze(1)
    
    def singulars(self):
        """Returns singular values: (batch, latent_dim)"""
        return self._singulars
    
    def add_zeros(self, vec):
        """Pads from latent_dim to data_dim: (batch, latent_dim) -> (batch, data_dim)"""
        # vec shape: (batch, latent_dim)
        batch_size = vec.shape[0]
        padding = self.data_dim - self.latent_dim
        return torch.cat([vec, torch.zeros(batch_size, padding)], dim=1)


ARGS = {
    # H_functions is a base class with no __init__ parameters
    # The concrete instance serves as self for the methods
}

# Instantiate concrete implementation for testing
h_funcs = ConcreteH_functions()
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 H_functions — 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 H_functions 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
Inpainting Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("0ae82c5ede22b668")
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, Inpainting: 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

torch.manual_seed(0)

# Parameters for Inpainting.__init__
channels = 1
img_dim = 2
device = 'cpu'

# Create dense_masks: shape (batch_size, channels * img_dim ** 2)
# batch_size = 2, total_pixels = 1 * 2 ** 2 = 4
batch_size = 2
total_pixels = channels * img_dim ** 2
dense_masks = torch.ones(batch_size, total_pixels)
# Set some pixels to 0 to create missing regions
dense_masks[0, 0] = 0
dense_masks[1, 2] = 0

ARGS = {
    'channels': channels,
    'img_dim': img_dim,
    'dense_masks': dense_masks,
    'device': device,
}
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 Inpainting — 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 Inpainting 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
Inpainting2 Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("7be00d2291252268")
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, Inpainting2: 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

torch.manual_seed(0)

# Parameters for Inpainting2.__init__
channels = 3
img_dim = 4
device = 'cpu'

# dense_masks: used in set_indices to index and reshape into _singulars
# The code does: dense_masks[idx].clone().to(device)
# Then: _singulars = _singulars.reshape(_singulars.size(0), -1)
# And singulars() returns self._singulars.float() with shape that gets used in H()
# We need a tensor where we can index by batch and it has a reshapeable structure
batch_size = 2
mask_count = 5
mask_spatial_dim = 4

dense_masks = torch.randn(mask_count, channels, mask_spatial_dim, mask_spatial_dim)

ARGS = {
    'channels': channels,
    'img_dim': img_dim,
    'dense_masks': dense_masks,
    'device': device
}
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 Inpainting2 — 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 Inpainting2 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
Kernel Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("c2af90d254ccfd46")
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, Kernel: 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 numpy as np

ARGS = {
    "size": (100, 100),
    "intensity": 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Kernel — 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 Kernel 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
NonlinearBlurOperator Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("145e71681d09f888")
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, NonlinearBlurOperator: 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 yaml
import tempfile
import os

torch.manual_seed(0)

# Create a minimal mock KernelWizard model
class MockKernelWizard(nn.Module):
    def __init__(self, opt):
        super().__init__()
        self.opt = opt
        self.linear = nn.Linear(3, 3)
    
    def adaptKernel(self, data, kernel):
        # Minimal implementation: just return data with slight modification
        batch_size = data.shape[0]
        return data + 0.1 * torch.randn_like(data)
    
    def eval(self):
        return super().eval()
    
    def load_state_dict(self, state_dict, strict=True):
        pass

# Patch the bkse module before importing
import sys
from types import ModuleType

bkse_module = ModuleType('bkse')
bkse_models = ModuleType('bkse.models')
bkse_kernel_encoding = ModuleType('bkse.models.kernel_encoding')
bkse_kernel_wizard = ModuleType('bkse.models.kernel_encoding.kernel_wizard')

bkse_kernel_wizard.KernelWizard = MockKernelWizard

sys.modules['bkse'] = bkse_module
sys.modules['bkse.models'] = bkse_models
sys.modules['bkse.models.kernel_encoding'] = bkse_kernel_encoding
sys.modules['bkse.models.kernel_encoding.kernel_wizard'] = bkse_kernel_wizard

# Create a temporary YAML file with required config
with tempfile.NamedTemporaryFile(mode='w', suffix='.yml', delete=False) as f:
    yaml_config = {
        'KernelWizard': {
            'in_channels': 3,
            'out_channels': 3,
            'num_features': 64
        }
    }
    yaml.dump(yaml_config, f)
    yaml_path = f.name

# Create a temporary model file
with tempfile.NamedTemporaryFile(mode='wb', suffix='.pth', delete=False) as f:
    model_file_path = f.name
    torch.save({}, model_file_path)

# Create a mock config object
class MockConfig:
    def __init__(self):
        self.deg = type('obj', (object,), {'pretrained_model_path': model_file_path})()

cfg = MockConfig()
current_dir = tempfile.gettempdir()
device = 'cpu'
opt_yml_path = yaml_path

ARGS = {
    'opt_yml_path': opt_yml_path,
    'current_dir': current_dir,
    'cfg': cfg,
    'device': device,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
bkse, torch, yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NonlinearBlurOperator — 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 NonlinearBlurOperator 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
PhaseRetrievalOperator Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("e2bcec0e8e006dd5")
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, PhaseRetrievalOperator: 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)

# PhaseRetrievalOperator takes two parameters: oversample and device
oversample_value = 2
device_value = 'cpu'

ARGS = {
    'oversample': oversample_value,
    'device': device_value
}
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 PhaseRetrievalOperator — 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 PhaseRetrievalOperator 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
Quantization Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("f41a66ced241dca1")
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, Quantization: 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

torch.manual_seed(0)

ARGS = {
    "n_bits": 8
}
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 Quantization — 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 Quantization 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
SRConv Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("7409f145ba888a09")
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, SRConv: 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 a small kernel tensor
kernel = torch.randn(3)  # kernel.shape[0] = 3

# Parameters
channels = 2
img_dim = 4
device = 'cpu'
stride = 1

ARGS = {
    'kernel': kernel,
    'channels': channels,
    'img_dim': img_dim,
    'device': device,
    'stride': stride,
}
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 SRConv — 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 SRConv 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
SuperResolution Ran
ran on a synthesized input · constructed an object; no result was computed
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("227f0fb97d62f667")
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, SuperResolution: 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

torch.manual_seed(0)

ARGS = {
    "channels": 3,
    "img_dim": 4,
    "ratio": 2,
    "device": "cpu"
}
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 SuperResolution — 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 SuperResolution 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
_generate_masks Ran
ran, honoured the contract we drafted
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("eb873be6f32b06c7")
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 (2, 60) 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 numpy as np
import torch

torch.manual_seed(0)
np.random.seed(0)

ARGS = {
    "n": 2,
    "c": 4,
    "h": 3,
    "w": 5,
    "device": torch.device("cpu"),
    "prob": 0.9,
}
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 (2, 60) — shape (2, 60) 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
fft2_m Ran
ran; our contract draft was wrong, not the code
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("e7311e88db6ad154")
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 (2, 4, 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

torch.manual_seed(0)

# The function fft2_m expects a tensor input x
# Looking at the function:
# 1. It checks if x is complex, if not converts to complex64
# 2. It calls fft2c_new on torch.view_as_real(x)
# 3. fft2c_new expects data with at least 3 dimensions where:
#    - dimensions -3 & -2 are spatial dimensions
#    - dimension -1 has size 2 (for complex representation as real)
# 4. After view_as_real on a complex tensor, we get an extra dimension of size 2 at the end
# So we need a complex tensor with shape at least (batch, height, width)

# Create a small complex tensor
# Shape: (batch=2, height=4, width=3) for spatial dims, will have size 2 added by view_as_real
x = torch.complex(
    torch.randn(2, 4, 3),
    torch.randn(2, 4, 3)
)

ARGS = {
    'x': x
}
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 (2, 4, 3) — shape (2, 4, 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
fft2c_new Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("816447d200680f31")
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, 4, 3, 2) 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
from torch.fft import fftshift, ifftshift

torch.manual_seed(0)

# Construct a complex-valued tensor with shape: (batch=2, height=4, width=3, complex=2)
# The last dimension must be size 2 (for real and imaginary parts)
data = torch.randn(2, 4, 3, 2)

ARGS = {
    'data': data,
    'norm': 'ortho'
}
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, 4, 3, 2) — shape (2, 4, 3, 2) 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_degreadation_image Ran
ran; our contract draft was wrong, not the code
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("a933de7de76557d7")
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, 3, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a small config class with dataset attributes
class DatasetConfig:
    def __init__(self):
        self.channels = 3
        self.image_size = 4

class Config:
    def __init__(self):
        self.dataset = DatasetConfig()

cfg = Config()

# Create a small H module that implements H_pinv method
class DegradationOperator(nn.Module):
    def __init__(self):
        super().__init__()
    
    def H_pinv(self, y):
        # y_0 is expected to be a tensor
        # H_pinv should return a tensor that can be reshaped to (-1, c, w, w)
        # For batch size 2, channels 3, image_size 4: output should be (2, 3, 4, 4) = 96
        batch_size = y.shape[0] if y.dim() > 0 else 1
        c = cfg.dataset.channels
        w = cfg.dataset.image_size
        output_size = batch_size * c * w * w
        return torch.randn(output_size)

H = DegradationOperator()

# Create y_0 tensor (batch_size=2, some feature dimension)
y_0 = torch.randn(2, 48)

ARGS = {
    "y_0": y_0,
    "H": H,
    "cfg": cfg
}
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, 3, 4, 4) — shape (2, 3, 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
ifft2_m Ran
ran; our contract draft was wrong, not the code
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("5fc916e4b9359935")
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 5, dtype family float, shape (2, 3, 4, 5, 2) 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 ifft2_m takes a single argument x
# It expects x to be a tensor that will be converted to complex if needed
# The tensor needs to have at least 3 dimensions where:
# - dimensions -3 & -2 are spatial dimensions
# - dimension -1 has size 2 (for the real/imaginary components)
# Create a test tensor with shape (batch=2, coils=3, height=4, width=5, complex=2)
x = torch.randn(2, 3, 4, 5, 2)

ARGS = {
    'x': x
}
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 5, dtype family float, shape (2, 3, 4, 5, 2) — shape (2, 3, 4, 5, 2) 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
ifft2c_new Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("1e028b85024231e6")
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 5, dtype family float, shape (2, 3, 4, 5, 2) 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 complex-valued tensor for ifft2c_new
# Shape requirements: at least 3 dimensions, last dimension = 2 (for complex representation)
# dimensions -3 & -2 are spatial dimensions
# Format: [..., height, width, 2] where the last dimension stores real and imaginary parts

# Example: batch_size=2, channels=3, height=4, width=5, complex=2
data = torch.randn(2, 3, 4, 5, 2)

ARGS = {
    'data': data,
    'norm': 'ortho'
}
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 5, dtype family float, shape (2, 3, 4, 5, 2) — shape (2, 3, 4, 5, 2) 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_mask Ran
ran, violated the contract we drafted
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("789b9f261d70e038")
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 float, shape (2, 3, 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 numpy as np
import tempfile
import os

# Create a temporary .npz file with the required structure
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_mask.npz")

# Create sample data
shape = (2, 3, 4)  # Example shape
m = np.array([True, False, True, False, True, True, False, False, 
              True, True, False, True, False, False, True, False,
              True, False, True, False, True, True, False, False], dtype=bool)
m_flat = m.astype(np.uint8)  # Store as uint8 and will be viewed as bool

# Save to npz file
np.savez(temp_file, m=m_flat, shape=np.array(shape))

ARGS = {
    'f': temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 float, shape (2, 3, 4) — shape (2, 3, 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
norm Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("594fad709f5a8599")
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 float, 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 numpy as np

torch.manual_seed(0)

# Construct a valid argument for the 'lst' parameter
# The function expects a list of numbers and computes their L2 norm
# Let's create a simple list of numeric values
lst = [3.0, 4.0]  # L2 norm should be 5.0

ARGS = {
    'lst': lst
}
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 float, 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
polar2z Ran
ran, violated the contract we drafted
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("7c37ca7a5cce1a9c")
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 1, dtype family float, shape (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 numpy as np

# Create small numpy arrays for radius and angle
r = np.array([1.0, 2.0, 3.0])
θ = np.array([0.0, np.pi/4, np.pi/2])

ARGS = {
    "r": r,
    "θ": θ,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (3,) — shape (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
postprocess Ran
ran, honoured the contract we drafted
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("3464de9ecaec7ab8")
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 (2, 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
import numpy as np

torch.manual_seed(0)

# The function postprocess takes a single parameter x
# It checks if x is a list, and if so, applies (v + 1) / 2 to each element
# Otherwise it applies (x + 1) / 2 directly to x
# x can be a list of tensors or a tensor itself

# Test case 1: x is a tensor
x_tensor = torch.randn(2, 4)

# Test case 2: x is a list of tensors
x_list = [torch.randn(2, 4), torch.randn(3, 5)]

# We'll use the tensor case as the primary argument
ARGS = {
    "x": x_tensor
}
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 (2, 4) — shape (2, 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
BDeblur Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("59c972439cda37dc")
How it ran

no invocation recorded.

BlindImageDeblurring Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("7030d9cea95cdb1b")
How it ran

no invocation recorded.

Blurkernel Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("7dd8e8db87c7fd43")
How it ran

no invocation recorded.

DDIM Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("d3f739f828f9ced4")
How it ran

no invocation recorded.

JPEG Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("209d87580d017e23")
How it ran

no invocation recorded.

NDTM Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("61acb2ecfa5f1aeb")
How it ran

no invocation recorded.

NonLinearOperator Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("665f19e750d67297")
How it ran

no invocation recorded.

build_degredation_model Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("f60cfe5f4ecd94c4")
How it ran

no invocation recorded.

build_one_degredation_model Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("df951fd1e4c0af59")
How it ran

no invocation recorded.

jpeg_decode Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("4f7a44cd35a6ec25")
How it ran

no invocation recorded.

jpeg_encode Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("bbdb00b7e6e8b170")
How it ran

no invocation recorded.

pdf Not yet run
unverified (harvested, no recorded run)
czi-ai/oc-guidance/algos/ndtm.py
code served (permissive licence) · get_code("d71b71588b63f3d0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 37 samples lifted from this paper's linked repositories, 37 carry a function identity and 0 do not. Of the 37 distinct functions with an identity, 5 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 2 later) and 32 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
fft2c_new
brick of this paper's assembly: helper
12 other papers
12 dated earlier
2110.05243 (2021-10)
Score-based diffusion models for accelerated MRI
2303.05754 (2023-03)
Decomposed Diffusion Sampler for Accelerating Large-Scale Inverse Problems
and 9 more not named here
ifft2c_new
brick of this paper's assembly: helper
3 other papers
3 dated earlier
2303.05754 (2023-03)
Decomposed Diffusion Sampler for Accelerating Large-Scale Inverse Problems
2407.09896 (2024-07)
PSC: Posterior Sampling-Based Compression
2411.00605 (2024-11)
pcaGAN: Improving Posterior-Sampling cGANs via Principal Component Regularization
fft2_m
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2402.16907 (2024-02)
Diffusion Posterior Proximal Sampling for Image Restoration
2403.17042 (2024-03)
Provably Robust Score-Based Diffusion Posterior Sampling for Plug-and-Play Image Reconstruction
norm
brick of this paper's assembly: helper
1 other paper
1 later
2506.14605 (2025-06)
Unsupervised Imaging Inverse Problems with Diffusion Distribution Matching
polar2z
brick of this paper's assembly: helper
1 other paper
1 later
2506.14605 (2025-06)
Unsupervised Imaging Inverse Problems with Diffusion Distribution Matching

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-24.

Repositories linked to this paper

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

Abstract

Diffusion models exhibit excellent sample quality, but existing guidance methods often require additional model training or are limited to specific tasks. We revisit guidance in diffusion models from the perspective of variational inference and control, introducing Diffusion Trajectory Matching (DTM) that enables guiding pretrained diffusion trajectories to satisfy a terminal cost. DTM unifies a broad class of guidance methods and enables novel instantiations. We introduce a new method within this framework that achieves state-of-the-art results on several linear, non-linear, and blind inverse problems without requiring additional model training or specificity to pixel or latent space diffusion models. Our code will be available at https: //github.com/czi-ai/oc-guidance.

For agents

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

get_harvested_code_for_paper("2502.03686")
get_code_for_paper("2502.03686")
have("2502.03686")

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

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

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

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

Connect an agent — have() is free.