SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.15001 · NeurIPS · 2023

Contrastive Training of Complex-Valued Autoencoders for Object Discovery

Anand Gopalakrishnan, Jürgen Schmidhuber, Kazuki Irie, Aleksandar Stanić

arXiv · PDF · Open in the Atlas

Code that ran

29 of 38 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 4 honoured the contract we drafted, 1 violated it and 6 have no contract verdict; 18 failures of our instrument; 9 no recorded run), measured 2026-11-23; 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/2305.15001.json · badge: /api/ran/2305.15001.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
agopal42/ctcae canonical (classifier label)
classifier basis: classifier_2025
29 ran · 9 no recorded run
FunctionStatusWhere it lives
ComplexConv2d Ran
ran on a synthesized input · constructed an object; no result was computed
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("b94524beed8991fd")
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, ComplexConv2d: 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 math

torch.manual_seed(0)

# Define Conv2dTF class
class Conv2dTF(nn.Conv2d):
    """
    Conv2d with the padding behavior from TF
    """

    def __init__(self, *args, **kwargs):
        self.padding = kwargs.get('padding', 'SAME')
        kwargs['padding'] = 0
        super(Conv2dTF, self).__init__(*args, **kwargs)

    def _compute_padding(self, input, dim):
        input_size = input.size(dim + 2)
        filter_size = self.weight.size(dim + 2)
        effective_filter_size = (filter_size - 1) * self.dilation[dim] + 1
        out_size = (input_size + self.stride[dim] - 1) // self.stride[dim]
        total_padding = max(0, (out_size - 1) * self.stride[dim] + effective_filter_size - input_size)
        additional_padding = int(total_padding % 2 != 0)
        return (additional_padding, total_padding)

    def forward(self, input):
        if self.padding == 'VALID':
            return torch.nn.functional.conv2d(input, self.weight, self.bias, self.stride, padding=0, dilation=self.dilation, groups=self.groups)
        rows_odd, padding_rows = self._compute_padding(input, dim=0)
        cols_odd, padding_cols = self._compute_padding(input, dim=1)
        if rows_odd or cols_odd:
            input = torch.nn.functional.pad(input, [0, cols_odd, 0, rows_odd])
        return torch.nn.functional.conv2d(input, self.weight, self.bias, self.stride, padding=(padding_rows // 2, padding_cols // 2), dilation=self.dilation, groups=self.groups)


# Helper functions
def get_stable_angle(x: torch.tensor, eps=1e-08):
    """ Function to ensure that the gradients of .angle() are well behaved."""
    imag = x.imag
    y = x.clone()
    y.imag[(imag < eps) & (imag > -1.0 * eps)] = eps
    return y.angle()


def init_magnitude_bias(fan_in, bias):
    bound = 1 / math.sqrt(fan_in)
    torch.nn.init.uniform_(bias, -bound, bound)
    return bias


def init_phase_bias(bias):
    return nn.init.constant_(bias, val=0)


def get_conv_biases(n_out_channels, fan_in):
    magnitude_bias = nn.Parameter(torch.empty((1, n_out_channels, 1, 1)))
    magnitude_bias = init_magnitude_bias(fan_in, magnitude_bias)
    phase_bias = nn.Parameter(torch.empty((1, n_out_channels, 1, 1)))
    phase_bias = init_phase_bias(phase_bias)
    return (magnitude_bias, phase_bias)


def apply_layer(x, real_function, phase_bias=None, magnitude_bias=None):
    psi = real_function(x.real) + 1j * real_function(x.imag)
    m_psi = psi.abs()
    phi_psi = get_stable_angle(psi)
    chi = real_function(x.abs())
    if magnitude_bias is not None:
        m_psi = m_psi + magnitude_bias
        chi = chi + magnitude_bias
    if phase_bias is not None:
        phi_psi = phi_psi + phase_bias
    m = 0.5 * m_psi + 0.5 * chi
    return (m, phi_psi)


# Create networks namespace
import types as _types
networks = _types.SimpleNamespace(**{n: globals()[n] for n in ['Conv2dTF'] if n in globals()})


# ComplexConv2d class
class ComplexConv2d(nn.Module):

    def __init__(self, n_in_channels, n_out_channels, kernel_size=3, stride=1):
        super(ComplexConv2d, self).__init__()
        self.conv = networks.Conv2dTF(n_in_channels, n_out_channels, kernel_size, (stride, stride), bias=False)
        self.kernel_size = torch.nn.modules.utils._pair(kernel_size)
        fan_in = n_in_channels * self.kernel_size[0] * self.kernel_size[1]
        self.magnitude_bias, self.phase_bias = get_conv_biases(n_out_channels, fan_in)

    def forward(self, x):
        return apply_layer(x, self.conv, self.phase_bias, self.magnitude_bias)


# Setup arguments for ComplexConv2d instantiation
ARGS = {
    'n_in_channels': 3,
    'n_out_channels': 5,
    'kernel_size': 3,
    'stride': 1
}
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 ComplexConv2d — 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 ComplexConv2d 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
ComplexConvTranspose2d Ran
ran on a synthesized input · constructed an object; no result was computed
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("87f9df0c5ba0263b")
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, ComplexConvTranspose2d: 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 math

torch.manual_seed(0)

ARGS = {
    "n_in_channels": 3,
    "n_out_channels": 4,
    "kernel_size": 3,
    "stride": 1,
    "padding": 0,
    "output_padding": 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 ComplexConvTranspose2d — 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 ComplexConvTranspose2d 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
ComplexConvUpsample2d Ran
ran on a synthesized input
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("32fbb448bc6bee93")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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
import torch.nn as nn
import torch.nn.functional as F
import math
import types as _types

class Conv2dTF(nn.Conv2d):
    """
    Conv2d with the padding behavior from TF
    """

    def __init__(self, *args, **kwargs):
        self.padding = kwargs.get('padding', 'SAME')
        kwargs['padding'] = 0
        super(Conv2dTF, self).__init__(*args, **kwargs)

    def _compute_padding(self, input, dim):
        input_size = input.size(dim + 2)
        filter_size = self.weight.size(dim + 2)
        effective_filter_size = (filter_size - 1) * self.dilation[dim] + 1
        out_size = (input_size + self.stride[dim] - 1) // self.stride[dim]
        total_padding = max(0, (out_size - 1) * self.stride[dim] + effective_filter_size - input_size)
        additional_padding = int(total_padding % 2 != 0)
        return (additional_padding, total_padding)

    def forward(self, input):
        if self.padding == 'VALID':
            return F.conv2d(input, self.weight, self.bias, self.stride, padding=0, dilation=self.dilation, groups=self.groups)
        rows_odd, padding_rows = self._compute_padding(input, dim=0)
        cols_odd, padding_cols = self._compute_padding(input, dim=1)
        if rows_odd or cols_odd:
            input = F.pad(input, [0, cols_odd, 0, rows_odd])
        return F.conv2d(input, self.weight, self.bias, self.stride, padding=(padding_rows // 2, padding_cols // 2), dilation=self.dilation, groups=self.groups)

def get_stable_angle(x: torch.Tensor, eps=1e-08):
    imag = x.imag
    y = x.clone()
    y.imag[(imag < eps) & (imag > -1.0 * eps)] = eps
    return y.angle()

def init_magnitude_bias(fan_in, bias):
    bound = 1 / math.sqrt(fan_in)
    torch.nn.init.uniform_(bias, -bound, bound)
    return bias

def init_phase_bias(bias):
    return nn.init.constant_(bias, val=0)

def get_conv_biases(n_out_channels, fan_in):
    magnitude_bias = nn.Parameter(torch.empty((1, n_out_channels, 1, 1)))
    magnitude_bias = init_magnitude_bias(fan_in, magnitude_bias)
    phase_bias = nn.Parameter(torch.empty((1, n_out_channels, 1, 1)))
    phase_bias = init_phase_bias(phase_bias)
    return (magnitude_bias, phase_bias)

def apply_layer(x, real_function, phase_bias=None, magnitude_bias=None):
    psi = real_function(x.real) + 1j * real_function(x.imag)
    m_psi = psi.abs()
    phi_psi = get_stable_angle(psi)
    chi = real_function(x.abs())
    if magnitude_bias is not None:
        m_psi = m_psi + magnitude_bias
        chi = chi + magnitude_bias
    if phase_bias is not None:
        phi_psi = phi_psi + phase_bias
    m = 0.5 * m_psi + 0.5 * chi
    return (m, phi_psi)

class ComplexUpsample(nn.Module):

    def __init__(self, scale_factor):
        super(ComplexUpsample, self).__init__()
        self.upsample = torch.nn.Upsample(scale_factor=scale_factor, mode='nearest')

    def forward(self, x):
        up_x_real = self.upsample(x.real)
        up_x_imag = self.upsample(x.imag)
        return up_x_real + 1j * up_x_imag

class ComplexConv2d(nn.Module):

    def __init__(self, n_in_channels, n_out_channels, kernel_size=3, stride=1):
        super(ComplexConv2d, self).__init__()
        self.conv = Conv2dTF(n_in_channels, n_out_channels, kernel_size, (stride, stride), bias=False)
        self.kernel_size = nn.modules.utils._pair(kernel_size)
        fan_in = n_in_channels * self.kernel_size[0] * self.kernel_size[1]
        self.magnitude_bias, self.phase_bias = get_conv_biases(n_out_channels, fan_in)

    def forward(self, x):
        return apply_layer(x, self.conv, self.phase_bias, self.magnitude_bias)

class ComplexConvUpsample2d(ComplexConv2d):

    def __init__(self, n_in_channels, n_out_channels, kernel_size, stride=1, padding=0, output_padding=0):
        super(ComplexConvUpsample2d, self).__init__(n_in_channels, n_out_channels, kernel_size, 1)
        self.upsample = ComplexUpsample((stride, stride))

    def forward(self, x):
        x = self.upsample(x)
        return super().forward(x)

INIT_ARGS = {
    'n_in_channels': 3,
    'n_out_channels': 4,
    'kernel_size': 3,
    'stride': 2,
    'padding': 0,
    'output_padding': 0,
}

ARGS = {
    'x': torch.randn(2, 3, 8, 8, dtype=torch.complex64),
}

if __name__ == '__main__':
    model = ComplexConvUpsample2d(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output type: {type(output)}")
    print(f"Output: {output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ComplexLinear Ran
ran on a synthesized input · constructed an object; no result was computed
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("89bd4fbb5bfe4b2e")
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, ComplexLinear: 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 math

torch.manual_seed(0)

# Define ARGS dict mapping every parameter of ComplexLinear to a value
ARGS = {
    'n_in_channels': 4,
    'n_out_channels': 3
}
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 ComplexLinear — 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 ComplexLinear 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
ComplexUpsample Ran
ran on a synthesized input · constructed an object; no result was computed
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("2d311e2e21a3dbbf")
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, ComplexUpsample: 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
from typing import Tuple

torch.manual_seed(0)

class ComplexUpsample(nn.Module):

    def __init__(self, scale_factor: Tuple[float, float]):
        super(ComplexUpsample, self).__init__()
        self.upsample = torch.nn.Upsample(scale_factor=scale_factor, mode='nearest')

    def forward(self, x):
        up_x_real = self.upsample(x.real)
        up_x_imag = self.upsample(x.imag)
        return up_x_real + 1j * up_x_imag

# Create a small complex tensor for testing
# Shape: (batch=2, channels=4, height=3, width=5) for 4D input
complex_tensor = torch.randn(2, 4, 3, 5, dtype=torch.complex64)

# Define scale factors
scale_factor = (2.0, 2.0)

ARGS = {
    'scale_factor': scale_factor
}
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 ComplexUpsample — 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 ComplexUpsample 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
Conv2dTF Ran
ran on a synthesized input · constructed an object; no result was computed
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("e7d7eb775a61658c")
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, Conv2dTF: 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)

# Conv2dTF inherits from nn.Conv2d, so we need to provide all nn.Conv2d constructor arguments
# nn.Conv2d signature: (in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', device=None, dtype=None)

# For Conv2dTF.__init__, it accepts *args and **kwargs, with special handling of 'padding'
# The parent nn.Conv2d is called with padding=0 always

ARGS = {
    'in_channels': 3,
    'out_channels': 16,
    'kernel_size': (3, 3),
    'stride': (1, 1),
    'padding': 'SAME',  # Conv2dTF uses 'SAME' or 'VALID' instead of numeric padding
    'dilation': (1, 1),
    'groups': 1,
    'bias': True,
    'padding_mode': 'zeros',
}
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 Conv2dTF — 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 Conv2dTF 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
append_black_right_separator Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("e38855884ac1991b")
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 4, dtype family int, shape (2, 4, 53, 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 a small test image array with shape (batch, height, width, channels)
# Using distinct dimensions: batch=2, height=4, width=3, channels=3 (RGB)
imgs = np.random.randint(0, 256, size=(2, 4, 3, 3), dtype=np.uint8)

ARGS = {
    "imgs": imgs
}
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 4, dtype family int, shape (2, 4, 53, 3) — shape (2, 4, 53, 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
append_border_pixels Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("d3123efe45c58cc9")
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 4, dtype family int, shape (2, 8, 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 numpy as np

# Construct a small test image array with shape (batch, height, width, channels)
# Using distinct sizes: batch=2, height=4, width=3, channels=3 (RGB)
imgs = np.random.randint(0, 256, size=(2, 4, 3, 3), dtype=np.uint8)

# Construct a valid hex color string
color = "#FF5733"

ARGS = {
    "imgs": imgs,
    "color": color,
}
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 4, dtype family int, shape (2, 8, 7, 3) — shape (2, 8, 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
apply_kmeans Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("8f2a3483310f84a5")
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
import numpy as np
from sklearn.cluster import KMeans

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

# Construct minimal valid arguments for apply_kmeans
batch_size = 2
num_angles = 2
img_h, img_w = 4, 3
num_clusters = 3

# phase_mask_threshold: int or float, used in conditional
phase_mask_threshold = 0.5

# output_phase: tensor of shape (batch_size, num_angles, ...)
# Based on the code, it's indexed as output_phase[img_idx] and compared with len(torch.unique(...))
output_phase = torch.randn(batch_size, num_angles, img_h, img_w)

# output_norm_magnitude: tensor used in phase_to_cartesian_coordinates
# It's indexed as output_norm_magnitude[:, None], so shape (batch_size, ...)
output_norm_magnitude = torch.ones(batch_size, img_h, img_w)

# labels_true: tensor with unique values to determine num_clusters
# torch.unique(labels_true) and torch.unique(labels_true[img_idx]) are called
# Create labels with values 0, 1, 2 (and -1 for invalid) to get 3 unique values
labels_true = torch.tensor(
    [
        [[0, 1, 2, -1],
         [1, 2, 0, -1],
         [2, 0, 1, -1]],
        [[0, 1, 2, -1],
         [1, 2, 0, -1],
         [2, 0, 1, -1]]
    ]
)

# img_resolution: tuple (height, width) used for output shape
img_resolution = (4, 3)

# seed: random seed for KMeans
seed = 42

ARGS = {
    'phase_mask_threshold': phase_mask_threshold,
    'output_phase': output_phase,
    'output_norm_magnitude': output_norm_magnitude,
    'labels_true': labels_true,
    'img_resolution': img_resolution,
    'seed': seed
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, numpy, sklearn, 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
apply_layer Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("193817cd55076b39")
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
import torch.nn as nn

torch.manual_seed(0)

# Create a small real function (neural network layer)
class RealFunction(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the real function
real_function = RealFunction()

# Create a small complex input tensor (batch=2, dim=4)
x = torch.randn(2, 4, dtype=torch.complex64)

# Create optional bias tensors
magnitude_bias = torch.randn(2, 4)
phase_bias = torch.randn(2, 4)

# Define ARGS dictionary with all parameters
ARGS = {
    "x": x,
    "real_function": real_function,
    "phase_bias": phase_bias,
    "magnitude_bias": magnitude_bias,
}
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
batch_to_rowwise_image Ran
ran, violated the contract we drafted
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("bfcf0002f0908e3b")
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 (8, 3, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a sample batch of images
# Shape: (batch_size, height, width, channels)
# Using distinct dimensions: 2 batch, 4 height, 3 width, 5 channels
imgs = np.random.randn(2, 4, 3, 5).astype(np.float32)

ARGS = {
    "imgs": imgs
}
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 (8, 3, 5) — shape (8, 3, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calc_ari_score Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("8fbf469567396916")
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 numpy as np

# Set seed for reproducibility
np.random.seed(0)

# Create small test data
batch_size = 2
height = 4
width = 3

# labels_true: shape (batch_size, height, width)
# Values should be in range [-1, 0, 1, 2] to test the filtering logic
labels_true = np.array([
    [[-1, 0, 1], [0, 1, 2], [1, 2, 1], [0, 1, -1]],
    [[0, 1, 2], [-1, 1, 0], [2, 1, 0], [1, -1, 2]]
], dtype=np.int32)

# labels_pred: shape (batch_size, height, width)
# Predicted cluster assignments in similar range
labels_pred = np.array([
    [[0, 0, 1], [0, 1, 2], [1, 2, 1], [0, 1, 0]],
    [[0, 1, 2], [0, 1, 0], [2, 1, 0], [1, 0, 2]]
], dtype=np.int32)

ARGS = {
    "batch_size": batch_size,
    "labels_true": labels_true,
    "labels_pred": labels_pred,
    "with_background": True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
calculate_cluster_metrics Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("82c5b64172909c18")
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 dict. 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
from sklearn.cluster import KMeans

# Create small sample data
np.random.seed(0)
n_samples = 10
n_features = 4
n_clusters = 3

# Generate random data for in_phase
in_phase = np.random.randn(n_samples, n_features).astype(np.float32)

# Fit KMeans to get a k_means object with required attributes
k_means = KMeans(n_clusters=n_clusters, random_state=0, n_init=10)
k_means.fit(in_phase)

# k_means now has:
# - cluster_centers_: shape (n_clusters, n_features)
# - labels_: shape (n_samples,)

ARGS = {
    'in_phase': in_phase,
    'k_means': k_means,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
clip_and_rescale Ran
ran, honoured the contract we drafted
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("e30f758e4571b29b")
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)

# Test with a torch tensor
input_tensor_torch = torch.randn(2, 4)

# Test with a numpy array
input_tensor_numpy = np.random.randn(2, 4)

# Clip value
clip_value = 1.0

# Create ARGS dict with torch tensor version
ARGS = {
    "input_tensor": input_tensor_torch,
    "clip_value": clip_value
}
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
color_hex_to_float Ran
ran, honoured the contract we drafted
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("6d8ef248dfd50c0e")
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

ARGS = {
    "hex_color": "#FF5733"
}
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
color_hex_to_int Ran
ran, honoured the contract we drafted
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("0f73b6f5607dbfc0")
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 int, 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

# The function takes a hex color string and converts it to RGB integers
# It uses lstrip to remove '#' and then parses pairs of hex digits

ARGS = {
    "hex_color": "#FF5733"
}
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 int, 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
combined_labels_to_colormap Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("b1411375ee85340e")
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 4, dtype family float, shape (2, 3, 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
import numpy as np

torch.manual_seed(0)

# Create a small combined_labels tensor
# Shape: (batch=2, height=3, width=4) with class indices
combined_labels = torch.randint(0, 5, (2, 3, 4), dtype=torch.int32)

# Add some -1 values to test the replacement logic
combined_labels[0, 0, 0] = -1

# Number of classes
number_of_classes = 5

ARGS = {
    "combined_labels": combined_labels,
    "number_of_classes": number_of_classes,
}
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 ndarray, ndim 4, dtype family float, shape (2, 3, 4, 3) — shape (2, 3, 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
get_anchors_positive_and_negative_pairs Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("d8c2b4c45997c4de")
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
import random

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

# Construct tiny tensors for the function
# addresses and features need compatible spatial dimensions
batch_size = 2
channels = 4
spatial_size = 8  # Will be divided by patch_size

# Create addresses tensor: shape (batch, channels, height, width)
addresses = torch.randn(batch_size, channels, spatial_size, spatial_size)

# Create features tensor: same spatial structure
features = torch.randn(batch_size, channels, spatial_size, spatial_size)

# Parameters for anchor/positive/negative sampling
n_anchors_to_sample = 3
n_positive_pairs = 2
n_negative_pairs = 2
top_k = 5
bottom_m = 3
use_patches = True
patch_size = 2  # spatial_size must be divisible by this

ARGS = {
    "addresses": addresses,
    "features": features,
    "n_anchors_to_sample": n_anchors_to_sample,
    "n_positive_pairs": n_positive_pairs,
    "n_negative_pairs": n_negative_pairs,
    "top_k": top_k,
    "bottom_m": bottom_m,
    "use_patches": use_patches,
    "patch_size": patch_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, 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
get_ari_for_n_objects Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("94ad841b3183e122")
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, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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

# Construct valid arguments for get_ari_for_n_objects
# The function expects:
# - ari_w_bg_scores: array of ARI scores (with background)
# - ari_wo_bg_scores: array of ARI scores (without background)
# - n_objects: array indicating number of objects for each sample
# - n_objects_max: maximum number of objects

# Create sample data
np.random.seed(0)

# Number of samples
n_samples = 10

# Create ARI scores (values between -1 and 1, typical for ARI metric)
ari_w_bg_scores = np.random.uniform(-0.5, 1.0, n_samples).astype(np.float32)
ari_wo_bg_scores = np.random.uniform(-0.5, 1.0, n_samples).astype(np.float32)

# Create n_objects array with values from 0 to 4
n_objects = np.array([0, 1, 1, 2, 2, 2, 3, 3, 4, 4], dtype=np.int32)

# Maximum number of objects
n_objects_max = 5

ARGS = {
    "ari_w_bg_scores": ari_w_bg_scores,
    "ari_wo_bg_scores": ari_wo_bg_scores,
    "n_objects": n_objects,
    "n_objects_max": n_objects_max
}
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 tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
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_conv_biases Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("48ac46b5f4b9ad19")
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 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 math
import torch
import torch.nn as nn

torch.manual_seed(0)

# The function get_conv_biases takes two parameters:
# - n_out_channels: int (number of output channels)
# - fan_in: int (fan-in for initialization bound calculation)

ARGS = {
    "n_out_channels": 16,
    "fan_in": 9,
}
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 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
get_conv_layers_shapes Ran
ran, honoured the contract we drafted
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("336163d2a29c0496")
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 list, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 ConvModule(nn.Module):
    def __init__(self, in_channels, out_channels):
        super().__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)
    
    def forward(self, x):
        # x is complex-valued
        # Return (magnitude, phase) tuple
        m = self.conv(x.real)
        phi = self.conv(x.imag)
        return m, phi

conv_layers = nn.ModuleList([
    ConvModule(1, 2),
    ConvModule(2, 3),
])

ARGS = {
    "conv_layers": conv_layers,
    "d_channels": 1,
    "d_height": 4,
    "d_width": 3,
}
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 list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
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_stable_angle Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("09227b2bfcaed35e")
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

torch.manual_seed(0)

# Create a complex tensor with small imaginary parts to test the function
x = torch.randn(2, 4, dtype=torch.complex64)

ARGS = {
    "x": x,
    "eps": 1e-08
}
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 (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
init_conv_norms Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("d910d2285daa4de1")
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 ModuleList. 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)

# conv_shapes should be a list of tuples/lists where each element represents
# the shape of a convolution layer. The function accesses conv_shape[0] to get
# the number of channels for BatchNorm2d.
# We'll create a list of conv shapes with distinct channel dimensions.

conv_shapes = [
    (4,),      # 4 channels for first conv layer
    (8,),      # 8 channels for second conv layer
    (16,),     # 16 channels for third conv layer
]

ARGS = {
    "conv_shapes": conv_shapes,
}
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 ModuleList — a ModuleList output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ModuleList output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_magnitude_bias Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("d97fbc4d2b3f3597")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 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
import math

torch.manual_seed(0)

# Create a small bias tensor
bias = torch.zeros(4, requires_grad=True)

# Set up arguments
ARGS = {
    "fan_in": 8,
    "bias": bias
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 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
init_phase_bias Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("201529a35cce67ab")
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 Parameter, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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)

# The function init_phase_bias takes a bias parameter and initializes it to 0
# The bias is typically a parameter from a neural network layer (1D tensor)
bias = nn.Parameter(torch.randn(4))

ARGS = {
    "bias": bias
}
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 Parameter, ndim 1, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 1, which disagrees with the fixture run
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
phase_to_cartesian_coordinates Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("f53d25628716495f")
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, 2, 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)

# Create small tensors for testing
batch_size = 2
phase_dim = 3

# phase: tensor of shape (batch_size, phase_dim) - angles in radians
phase = torch.randn(batch_size, phase_dim)

# norm_magnitude: tensor of shape (batch_size,) - magnitudes/weights
norm_magnitude = torch.ones(batch_size) * 0.5

# phase_mask_threshold: scalar threshold value
phase_mask_threshold = 0.1

ARGS = {
    "phase_mask_threshold": phase_mask_threshold,
    "phase": phase,
    "norm_magnitude": norm_magnitude,
}
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, 2, 3) — shape (2, 2, 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
resize_image_batch Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("456f8ca4ca4808a4")
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 4, dtype family int, shape (2, 5, 6, 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
import cv2

# Create a small batch of images
# The function expects a numpy array of shape (batch_size, height, width, channels)
# or (batch_size, height, width) for grayscale
batch_size = 2
height = 4
width = 3
channels = 3

# Create a small image batch with random values (uint8 for typical image format)
image_batch = np.random.randint(0, 256, size=(batch_size, height, width, channels), dtype=np.uint8)

# Define the new size for resizing
new_size = (6, 5)  # (width, height) as expected by cv2.resize

ARGS = {
    "image_batch": image_batch,
    "new_size": new_size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 4, dtype family int, shape (2, 5, 6, 3) — shape (2, 5, 6, 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
spherical_to_cartesian_coordinates Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("f10f65f89cbbf0d1")
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

torch.manual_seed(0)

# The function expects a tensor x with shape (batch_size, num_dims)
# where num_dims >= 2 (since it accesses x[:, 0] for r and x[:, 1:] for phi)
# The function performs spherical to cartesian coordinate conversion

batch_size = 2
num_dims = 4

# Create a small tensor with spherical coordinates
# First column is radius r, remaining columns are angles phi
x = torch.randn(batch_size, num_dims)

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 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
tensor_to_wandb_image Ran
ran; our contract draft was wrong, not the code
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("419682da2a94001b")
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 Image. 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
import wandb
import PIL

torch.manual_seed(0)

# Create a valid tensor argument
# The function expects a tensor with shape suitable for image conversion
# If shape[0] is 1 or 3, it transposes from (C, H, W) to (H, W, C)
# So let's create a (3, 4, 5) tensor (3 channels, 4 height, 5 width)
data_tensor = torch.rand(3, 4, 5)

ARGS = {
    "data": data_tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, wandb — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image 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
CAEMetricsRecorder Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("c4b48ec9eac36ca1")
How it ran

no invocation recorded.

ComplexAutoEncoderV2 Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("9e50df740846fc6b")
How it ran

no invocation recorded.

ComplexConvDecoder Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("a9b5cc6c540885a0")
How it ran

no invocation recorded.

ComplexEncoder Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("a1c42747d2fcef56")
How it ran

no invocation recorded.

append_mutiple_radial_plot_tuples Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("bf4c0805a187d0c9")
How it ran

no invocation recorded.

append_single_radial_plot_tuple Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("54c7e6a22859d9a0")
How it ran

no invocation recorded.

canvas_to_numpy Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("42afe1af390dce9a")
How it ran

no invocation recorded.

create_image_grids_for_logging Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("f2983ab9dcaa0a6d")
How it ran

no invocation recorded.

create_phase_colorcoded_groupings_and_radial_plots Not yet run
unverified (harvested, no recorded run)
agopal42/ctcae/models/ctcae_model.py
code served (permissive licence) · get_code("3e77d62b6f031b43")
How it ran

no invocation recorded.

Also present in other papers' code

Of 38 samples lifted from this paper's linked repositories, 38 carry a function identity and 0 do not. Of the 38 distinct functions with an identity, 6 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 6 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
clip_and_rescale
brick of this paper's assembly: helper
1 other paper
1 later
2405.17283 (2024-05)
Recurrent Complex-Weighted Autoencoders for Unsupervised Object Discovery
color_hex_to_float
brick of this paper's assembly: helper
1 other paper
1 later
2405.17283 (2024-05)
Recurrent Complex-Weighted Autoencoders for Unsupervised Object Discovery
color_hex_to_int
brick of this paper's assembly: helper
1 other paper
1 later
2405.17283 (2024-05)
Recurrent Complex-Weighted Autoencoders for Unsupervised Object Discovery
phase_to_cartesian_coordinates
brick of this paper's assembly: helper
1 other paper
1 later
2405.17283 (2024-05)
Recurrent Complex-Weighted Autoencoders for Unsupervised Object Discovery
spherical_to_cartesian_coordinates
brick of this paper's assembly: helper
1 other paper
1 later
2405.17283 (2024-05)
Recurrent Complex-Weighted Autoencoders for Unsupervised Object Discovery
tensor_to_wandb_image
brick of this paper's assembly: helper
1 other paper
1 later
2405.17283 (2024-05)
Recurrent Complex-Weighted Autoencoders for Unsupervised Object Discovery

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

Repositories linked to this paper

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

Abstract

Current state-of-the-art object-centric models use slots and attention-based routing for binding. However, this class of models has several conceptual limitations: the number of slots is hardwired; all slots have equal capacity; training has high computational cost; there are no object-level relational factors within slots. Synchronybased models in principle can address these limitations by using complex-valued activations which store binding information in their phase components. However, working examples of such synchrony-based models have been developed only very recently, and are still limited to toy grayscale datasets and simultaneous storage of less than three objects in practice. Here we introduce architectural modifications and a novel contrastive learning method that greatly improve the state-of-the-art synchrony-based model. For the first time, we obtain a class of synchrony-based models capable of discovering objects in an unsupervised manner in multi-object color datasets and simultaneously representing more than three objects. 1 * Equal contribution. † Work done at IDSIA.

For agents

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

get_harvested_code_for_paper("2305.15001")
get_code_for_paper("2305.15001")
have("2305.15001")

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

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

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

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

Connect an agent — have() is free.