SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_27987 · AAAI · 2024

Optimize & Reduce: A Top-Down Approach for Image Vectorization

Or Hirschorn, Amir Jevnisek, Shai Avidan

Open in the Atlas

Code that ran

19 of 21 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 17 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/aaai_27987.json · badge: /api/ran/aaai_27987.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
ajevnisek/optimize-and-reduce canonical (classifier label)
classifier basis: census
19 ran · 2 no recorded run
FunctionStatusWhere it lives
bhattacharyya_distance Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/histogram_loss.py
code served (permissive licence) · get_code("ac9baa84b0821a20")
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 float64, ndim 0, 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

# Create two probability distributions (or similar non-negative arrays that sum to 1)
p = np.array([0.2, 0.3, 0.3, 0.2])
q = np.array([0.1, 0.4, 0.3, 0.2])

ARGS = {
    "p": p,
    "q": q,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, 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
compute_pj Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/histogram.py
code served (permissive licence) · get_code("a8894a184c0e17f4")
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, 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 torch
from torch import nn, sigmoid

torch.manual_seed(0)

# Construct arguments for compute_pj(x, mu_k, K, L, W)
x = torch.randn(2, 4)  # batch_size=2, feature_dim=4
K = 3  # number of basis functions
mu_k = torch.randn(1, K, 4)  # centers for K basis functions, shape (1, K, feature_dim)
L = 1.0  # length scale parameter
W = 0.5  # width parameter

ARGS = {
    "x": x,
    "mu_k": mu_k,
    "K": K,
    "L": L,
    "W": W,
}
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, 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
compute_sine_theta Ran
ran; our contract draft was wrong, not the code
ajevnisek/optimize-and-reduce/models/loss.py
code served (permissive licence) · get_code("10df26dd8a42e188")
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 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

torch.manual_seed(0)

# The function compute_sine_theta expects two arguments s1 and s2
# Each should be a tensor where:
# - s1[0, :] and s1[1, :] are two points (vectors)
# - s2[0, :] and s2[1, :] are two points (vectors)
# The function computes the sine of the angle between the two direction vectors

# Create two tensors of shape (2, 4) - 2 points with 4 dimensions each
s1 = torch.tensor([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
])

s2 = torch.tensor([
    [0.0, 1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0, 7.0]
])

ARGS = {
    "s1": s1,
    "s2": s2
}
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 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
count_clusterless_pixels Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/histogram_loss.py
code served (permissive licence) · get_code("5c2f2a94c09202c1")
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 0, dtype family int, 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)

# The function expects labels_img which should support:
# - comparison with -1 (== operator)
# - .sum() method
# This is compatible with torch tensors and numpy arrays

# Create a small labels image with some pixels labeled as -1 (clusterless)
# and some with other values (clustered)
labels_img = torch.tensor([
    [-1, 0, 1, -1],
    [2, -1, 0, 1],
    [-1, -1, 2, 0]
], dtype=torch.int32)

ARGS = {
    "labels_img": labels_img
}
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 0, dtype family int, 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
downsample Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ajevnisek/optimize-and-reduce/models/pyramid.py
code served (permissive licence) · get_code("1f6001e1c3b06556")
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, 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 downsample takes a tensor x and performs spatial downsampling
# by taking every 2nd element along dimensions 2 and 3.
# This suggests x should be a 4D tensor (batch, channels, height, width)

x = torch.randn(2, 4, 8, 6)  # batch=2, channels=4, height=8, width=6

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 4, dtype family float, shape (2, 4, 4, 3) — shape (2, 4, 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
gaussian_conv2d Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/pyramid.py
code served (permissive licence) · get_code("7f7c8d28544d3c2a")
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, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

# Create input tensor: (batch=2, channels=3, height=4, width=5)
x = torch.randn(2, 3, 4, 5, dtype=torch.float)

# Create Gaussian kernel for conv2d
# Shape should be (out_channels, in_channels/groups, kernel_height, kernel_width)
# For depthwise convolution (groups=channels), we need (channels, 1, k_h, k_w)
# channels = 3, kernel_size = 3x3
g_kernel = torch.randn(3, 1, 3, 3, dtype=torch.float)

# dtype parameter
dtype = torch.float

ARGS = {
    'x': x,
    'g_kernel': g_kernel,
    'dtype': dtype
}
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, 5) — shape (2, 3, 4, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
gaussian_kernel Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/pyramid.py
code served (permissive licence) · get_code("2951c06021603cd6")
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 (3, 1, 5, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    "size": 5,
    "device": torch.device('cpu'),
    "channels": 3,
    "sigma": 1,
    "dtype": torch.float
}
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 4, dtype family float, shape (3, 1, 5, 5) — shape (3, 1, 5, 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
get_bezier_circle Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/painter_params.py
code served (permissive licence) · get_code("a09c0fa54cf3758e")
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 (12, 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 random
import numpy as np
import torch

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

# Create a bias tensor on CPU
bias = torch.tensor([0.5, 0.3])

ARGS = {
    "radius": 1.0,
    "segments": 4,
    "bias": bias
}
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 (12, 2) — shape (12, 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_num_clusters Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/histogram_loss.py
code served (permissive licence) · get_code("dce4d8ab823a5583")
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 int, ndim 0, dtype family int, 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 numpy as np
from sklearn.cluster import KMeans

# Create a simple clustering object with labels_ attribute
X = np.array([[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]])
clustering_obj = KMeans(n_clusters=3, random_state=0, n_init=10)
clustering_obj.fit(X)

ARGS = {
    "clustering_obj": clustering_obj
}
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 int, ndim 0, dtype family int, 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
interpret Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/painter_params.py
code served (permissive licence) · get_code("b37adb999a8a7d79")
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 2, dtype family float, shape (224, 224) 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
import numpy as np

torch.manual_seed(0)

# Build a minimal mock model that satisfies the function's requirements
class MockAttentionBlock(nn.Module):
    def __init__(self, num_tokens):
        super().__init__()
        self.num_tokens = num_tokens
        # attn_probs is accessed and used in the function
        self.attn_probs = torch.randn(1, 12, num_tokens, num_tokens)
    
    def forward(self, x):
        return x

class MockVisualTransformer(nn.Module):
    def __init__(self, num_tokens):
        super().__init__()
        self.resblocks = nn.ModuleDict({
            'block_0': MockAttentionBlock(num_tokens),
            'block_1': MockAttentionBlock(num_tokens),
        })
    
    def forward(self, x):
        return x

class MockVisual(nn.Module):
    def __init__(self, num_tokens):
        super().__init__()
        self.transformer = MockVisualTransformer(num_tokens)
    
    def forward(self, x):
        return x

class MockCLIPModel(nn.Module):
    def __init__(self, num_tokens=49):
        super().__init__()
        self.visual = MockVisual(num_tokens)
    
    def encode_image(self, images):
        return torch.randn(1, 512)
    
    def zero_grad(self):
        super().zero_grad()
    
    def forward(self, images):
        return self.encode_image(images)

# Create arguments
device = 'cpu'
image = torch.randn(1, 3, 224, 224)
texts = ["a cat", "a dog"]
model = MockCLIPModel(num_tokens=50)

ARGS = {
    'image': image,
    'texts': texts,
    'model': model,
    'device': device,
}
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 2, dtype family float, shape (224, 224) — shape (224, 224) 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
is_rgba Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/basic_diffvg.py
code served (permissive licence) · get_code("70e0e5ac1aac5323")
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 bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function checks if the last dimension of a tensor is 4
# So we need a tensor with shape ending in 4
tensor = torch.randn(2, 3, 4)

ARGS = {
    "tensor": tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
l2_layers Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/loss.py
pointer only (licence: MIT); the stored copy get_code serves, from ayanban011/svgcraft, is pointer only (licence: NONE) · get_code("3aa37678e56ebdb0")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from ayanban011/svgcraft, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

maskLoss Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/decomp.py
code served (permissive licence) · get_code("d24e9a0a10f82a55")
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 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

torch.manual_seed(0)

# Construct tensors for the function
# recon: batch of reconstructions, each with 4 channels (3 RGB + 1 alpha)
# Shape: (batch_size, 4, height, width)
batch_size = 2
height = 5
width = 6
recon = torch.rand(batch_size, 4, height, width)

# trgt: target image with 3 channels (RGB)
# Shape: (3, height, width) - used without batch dimension
trgt = torch.rand(3, height, width)

# masks: list of masks, one per batch item
# Each mask shape: (height, width) with values in [0, 1]
masks = [torch.rand(height, width) for _ in range(batch_size)]

ARGS = {
    "recon": recon,
    "trgt": trgt,
    "masks": masks,
}
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 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
or_gate Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/geometric_loss.py
code served (permissive licence) · get_code("53f22d487698b50e")
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 torch.nn as nn

torch.manual_seed(0)

# The function or_gate(a, b) performs: a + b - a * b
# This is the logical OR operation when a and b are in [0, 1]
# The function expects two numeric arguments that support +, -, and * operations

# Create small tensors for a and b
a = torch.tensor([[0.0, 1.0, 0.5, 0.2],
                   [0.8, 0.3, 0.9, 0.1]], dtype=torch.float32)

b = torch.tensor([[1.0, 0.0, 0.5, 0.7],
                   [0.2, 0.6, 0.1, 0.9]], dtype=torch.float32)

ARGS = {
    "a": a,
    "b": b
}
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
orientation Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/geometric_loss.py
code served (permissive licence) · get_code("d67ccb9b9723d391")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family float, shape (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 expects p, q, r to be tensors with shape (..., 2)
# since it indexes into [..., 0] and [..., 1] for x and y coordinates
# We'll create small tensors with batch dimension of 2

p = torch.randn(2, 2)  # shape (2, 2) - batch of 2 points with (x, y) coords
q = torch.randn(2, 2)  # shape (2, 2)
r = torch.randn(2, 2)  # shape (2, 2)

ARGS = {
    "p": p,
    "q": q,
    "r": r
}
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 1, dtype family float, shape (2,) — shape (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
phi_k Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/histogram.py
code served (permissive licence) · get_code("54e18b1fc47a06a2")
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
from torch import nn, sigmoid

torch.manual_seed(0)

# Analyze the function:
# phi_k(x, L, W) takes three parameters:
# - x: used in arithmetic operations with L and W, then passed to sigmoid
# - L: a scalar used in (x + L / 2) / W and (x - L / 2) / W
# - W: a scalar used as divisor in (x + L / 2) / W and (x - L / 2) / W

# x should be a tensor (batch of 2, feature dim of 4)
x = torch.randn(2, 4)

# L is a scalar value
L = 1.0

# W is a scalar value (positive to avoid division issues)
W = 0.5

ARGS = {
    "x": x,
    "L": L,
    "W": W,
}
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
run_mrf_on_graph Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/decomp.py
code served (permissive licence) · get_code("797f776127fec190")
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 2, dtype family float, shape (3, 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 networkx as nx

# Create a small blurred mask for testing
# The function expects a 2D numpy array with values between 0 and 1
blurred_mask = np.array([
    [0.1, 0.3, 0.5],
    [0.2, 0.6, 0.7],
    [0.4, 0.8, 0.9]
], dtype=np.float32)

ARGS = {
    'blurred_mask': blurred_mask,
    'binary_term_weight': 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 3) — shape (3, 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
soft_composite Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/models/painter_params.py
code served (permissive licence) · get_code("31d2f005cd59bae5")
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 (3, 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 torch

torch.manual_seed(0)

# Analyze the function:
# - layers: list of tensors, each indexed with [3:4, :, :] for alpha channel and [:3] for RGB
#   Shape needs to be (C, H, W) where C >= 4 (RGBA), H and W are spatial dims
# - z_layers: list of tensors, used for element-wise multiplication with alpha channels
#   Should match the spatial dimensions of layers

# Create small tensors for layers (RGBA format: 4 channels, 3 height, 5 width)
height, width = 3, 5
num_layers = 2

layers = [
    torch.randn(4, height, width),  # RGBA tensor
    torch.randn(4, height, width),  # RGBA tensor
]

# Create z_layers - these are scalars or match spatial dims
# Based on usage: layers[i][3:4, :, :] * z_layers[i]
# z_layers should be broadcastable to (1, height, width)
z_layers = [
    torch.randn(1, height, width),
    torch.randn(1, height, width),
]

ARGS = {
    "layers": layers,
    "z_layers": z_layers,
}
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 (3, 3, 5) — shape (3, 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
xor_gate Ran
ran on a synthesized input
ajevnisek/optimize-and-reduce/geometric_loss.py
code served (permissive licence) · get_code("10ffe1a0871dd62a")
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 xor_gate takes two arguments a and b
# It performs element-wise operations: a + b - 2 * a * b
# This works with any numeric types that support +, -, and *

# Create small tensors for a and b
a = torch.tensor([[1.0, 0.0, 1.0, 0.0],
                   [0.0, 1.0, 0.0, 1.0]])

b = torch.tensor([[0.0, 1.0, 1.0, 0.0],
                   [1.0, 0.0, 0.0, 1.0]])

ARGS = {
    "a": a,
    "b": b
}
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
create_masks Not yet run
unverified (harvested, no recorded run)
ajevnisek/optimize-and-reduce/models/decomp.py
code served (permissive licence) · get_code("0a12a2a9fa34d3bd")
How it ran

no invocation recorded.

get_sdf Not yet run
unverified (harvested, no recorded run)
ajevnisek/optimize-and-reduce/models/loss.py
code served (permissive licence) · get_code("4b00a1a5801e9909")
How it ran

no invocation recorded.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 0 later) and 17 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
downsample 4 other papers
2 dated earlier, 2 same year, order not determinable
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
2308.02097 (2023-08)
Multi-interactive Feature Learning and a Full-time Multi-modality Benchmark for Image Fusion and Segmentation
2406.09754 (2024-06)
LAVIB: A Large-scale Video Interpolation Benchmark
and 1 more not named here
compute_sine_theta 2 other papers
1 dated earlier, 1 same year, order not determinable
2206.04655 (2022-06)
Towards Layer-wise Image Vectorization
2408.15741 (2024-08)
Segmentation-guided Layer-wise Image Vectorization with Gradient Fills
l2_layers 2 other papers
1 dated earlier, 1 same year, order not determinable
2308.14191 (2023-08)
SketchDreamer: Interactive Text-Augmented Creative Sketch Ideation
2404.00412 (2024-04)
CraftSVG: Multi-Object Text-to-SVG Synthesis via Layout Guided Diffusion
phi_k 2 other papers
2 dated earlier
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1904.12785 (2019-04)
Style Transfer by Relaxed Optimal Transport and Self-Similarity

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

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

Abstract

Vector image representation is a popular choice when editability and flexibility in resolution are desired. However, most images are only available in raster form, making raster-to-vector image conversion (vectorization) an important task. Classical methods for vectorization are either domain-specific or yield an abundance of shapes which limits editability and interpretability. Learning-based methods, that use differentiable rendering, have revolutionized vectorization, at the cost of poor generalization to out-of-training distribution domains, and optimization-based counterparts are either slow or produce non-editable and redundant shapes. In this work, we propose Optimize & Reduce (O&R), a topdown approach to vectorization that is both fast and domainagnostic. O&R aims to attain a compact representation of input images by iteratively optimizing Bézier curve parameters and significantly reducing the number of shapes, using a devised importance measure. We contribute a benchmark of five datasets comprising images from a broad spectrum of image complexities -from emojis to natural-like images. Through extensive experiments on hundreds of images, we demonstrate that our method is domain agnostic and outperforms existing works in both reconstruction and perceptual quality for a fixed number of shapes. Moreover, we show that our algorithm is ×10 faster than the state-of-the-art optimization-based method. Our code is publicly available: https://github.com/ajevnisek/optimize-and-reduce * These authors contributed equally.

For agents

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

get_harvested_code_for_paper("aaai_27987")
get_code_for_paper("aaai_27987")
have("aaai_27987")

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

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

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

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

Connect an agent — have() is free.