SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.16194 · 2021

Differentiable Drawing and Sketching

arXiv · PDF · Open in the Atlas

Code that ran

10 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 10 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2103.16194.json · badge: /api/ran/2103.16194.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
jonhare/DifferentiableSketching canonical (classifier label)
classifier basis: census
10 ran · 2 no recorded run
FunctionStatusWhere it lives
chamfer Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/losses/chamfer.py
code served (permissive licence) · get_code("e63b48b8994998c8")
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
import torch.nn as nn

torch.manual_seed(0)

# Create small squared distance transform function
def dt2_fcn(x: torch.Tensor) -> torch.Tensor:
    """Compute squared distance transform - returns same shape as input"""
    return x ** 2

# Create small rasterization function
def ras_fcn(x: torch.Tensor) -> torch.Tensor:
    """Convert target representation to binary raster - returns same shape as input"""
    return (x > 0).float()

# Create input tensor: batch_size=2, spatial dims=4x3
input_tensor = torch.randn(2, 4, 3)

# Create target tensor: batch_size=2, spatial dims=4x3
target_tensor = torch.randn(2, 4, 3)

ARGS = {
    'input': input_tensor,
    'target': target_tensor,
    'dt2_fcn': dt2_fcn,
    'ras_fcn': ras_fcn,
    'symmetric': False,
    'reduction': 'mean'
}
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
get_model Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/experiments/classifiers/models.py
code served (permissive licence) · get_code("b685d932806d1085")
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 type. 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 importlib
from unittest.mock import MagicMock

torch.manual_seed(0)

# The function uses importlib.import_module and getattr
# We need to mock the module structure so the function can successfully
# retrieve a model name from a mocked models module

# Create a mock models module
mock_models_module = MagicMock()

# Add a sample model to the mock module
class SimpleModel(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = torch.nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Attach a model to the mock module
mock_models_module.SampleModel = SimpleModel

# Mock the importlib.import_module to return our mock module
original_import = importlib.import_module

def mock_import_module(name):
    if 'models' in name:
        return mock_models_module
    return original_import(name)

importlib.import_module = mock_import_module

# Define the arguments for get_model
ARGS = {
    'name': 'SampleModel'
}
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 type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type 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
line_edt2 Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/raster/disttrans.py
code served (permissive licence) · get_code("0010130a3f24faed")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# For a 2D case (D=2):
# line: [batch, *, 2, D] where * can be empty or have additional dims
# grid: [*D, D] where *D represents D elements for each dimension

batch_size = 2
D = 2  # 2D coordinates

# Create line tensor: [batch=2, 2, D=2]
# First point and second point for each batch element
line = torch.tensor([
    [[0.0, 0.0], [1.0, 1.0]],  # batch 0: line from (0,0) to (1,1)
    [[0.5, 0.5], [2.0, 3.0]]   # batch 1: line from (0.5,0.5) to (2,3)
], dtype=torch.float32)

# Create grid tensor: [*D, D] = [4, 3, 2] for 2D with grid dimensions 4x3
# This represents a 4x3 lattice of 2D coordinates
grid_x = torch.linspace(0, 3, 4).unsqueeze(1).expand(4, 3)
grid_y = torch.linspace(0, 2, 3).unsqueeze(0).expand(4, 3)
grid = torch.stack([grid_x, grid_y], dim=-1)  # [4, 3, 2]

ARGS = {
    "line": line,
    "grid": grid
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
linear_bezier Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/raster/disttrans.py
code served (permissive licence) · get_code("fb85d39614859796")
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

torch.manual_seed(0)

# params: torch.Tensor of size [batch, 2, D]
# batch=2, D=4 (number of dimensions)
params = torch.randn(2, 2, 4)

# t: torch.Tensor of size [batch, nvalues, 1] or [nvalues, 1]
# Using [batch, nvalues, 1] format with batch=2, nvalues=3
t = torch.randn(2, 3, 1)

ARGS = {
    "params": params,
    "t": t,
}
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
normalize_tensor Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/experiments/shared/args_losses.py
code served (permissive licence) · get_code("15df2c2c65353c11")
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)

# Construct a small input tensor with shape (batch=2, dim=4)
in_feat = torch.randn(2, 4)

ARGS = {
    "in_feat": in_feat,
    "eps": 1e-10
}
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
over Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/raster/composite.py
code served (permissive licence) · get_code("2a3d84e0ecb779b8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 3, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small batched tensor of rasters
# Shape: [batch=2, height=4, width=3, nrasters=5, channels=2]
# This represents a batch of 2 images, each 4x3 pixels, with 5 raster layers, 2 channels each
rasters = torch.rand(2, 4, 3, 5, 2)

ARGS = {
    "rasters": rasters,
    "dim": 3,
    "keepdim": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 3, 2) — shape (2, 4, 3, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
over_recursive Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/raster/composite.py
code served (permissive licence) · get_code("51d43569fa33d82d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 3, 1) 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 small tensor representing batched rasters
# Shape: [batch=2, rows=4, cols=3, nrasters=2, channels=1]
# This represents 2 batches of 4x3 images with 2 rasters each and 1 channel
rasters = torch.rand(2, 4, 3, 2, 1, dtype=torch.float32)

# The dim parameter specifies which dimension contains the rasters to composite
# dim=3 means the rasters are stacked along dimension 3
dim = 3

ARGS = {
    "rasters": rasters,
    "dim": dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 3, 1) — shape (2, 4, 3, 1) 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
point_edt2 Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/raster/disttrans.py
code served (permissive licence) · get_code("7f780fcd49f3e680")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 5, dtype family float, shape (2, 4, 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

torch.manual_seed(0)

# point: [batch, *, D] - let's use batch=2, single spatial dim of size 4, D=3
point = torch.randn(2, 4, 3)

# grid: [*D, D] - for D=3, this should be [size_dim0, size_dim1, size_dim2, 3]
# Let's make a 2x3x4 grid of 3D coordinates
grid = torch.randn(2, 3, 4, 3)

ARGS = {
    "point": point,
    "grid": grid,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 5, dtype family float, shape (2, 4, 2, 3, 4) — shape (2, 4, 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
softor Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/raster/composite.py
code served (permissive licence) · get_code("149d6999c10e656b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 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)

# Construct a small tensor for rasters
# Shape: [batch, *, nrasters, D*]
# Let's use shape [2, 3, 4, 5] where:
# - batch size: 2
# - *: 3 (spatial dimension)
# - nrasters: 4
# - D*: 5 (feature dimension)
rasters = torch.rand(2, 3, 4, 5)

dim = 1
keepdim = False

ARGS = {
    "rasters": rasters,
    "dim": dim,
    "keepdim": keepdim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 4, 5) — shape (2, 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
spatial_average Ran
ran; our contract draft was wrong, not the code
jonhare/DifferentiableSketching/dsketch/experiments/shared/args_losses.py
code served (permissive licence) · get_code("9b40691985d4c7c9")
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, 1, 1) 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 takes in_tens (a tensor) and keepdim (boolean, default True)
# It handles 2D tensors by reshaping to 4D, then averages over dimensions 2 and 3
# We need to test with both 2D and 4D tensors

# Test with a 4D tensor: (batch=2, channels=4, height=3, width=5)
in_tens_4d = torch.randn(2, 4, 3, 5)

ARGS = {
    "in_tens": in_tens_4d,
    "keepdim": True,
}
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, 1, 1) — shape (2, 4, 1, 1) 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
chamfer_line Not yet run
unverified (harvested, no recorded run)
jonhare/DifferentiableSketching/dsketch/losses/chamfer.py
code served (permissive licence) · get_code("e2b3f9607074c6c3")
How it ran

no invocation recorded.

createVGG16FE Not yet run
unverified (harvested, no recorded run)
jonhare/DifferentiableSketching/dsketch/experiments/shared/args_losses.py
code served (permissive licence) · get_code("33d6d4f6dda2d58c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 11 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
normalize_tensor 11 other papers
1 dated earlier, 10 later
2002.09219 (2020-02)
Stochastic Latent Residual Video Prediction
2111.14292 (2021-11)
Deblur-NeRF: Neural Radiance Fields from Blurry Images
2203.09301 (2022-03)
One-Shot Adaptation of GAN in Just One CLIP
and 8 more not named here

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

Repositories linked to this paper

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

Abstract

We present a bottom-up differentiable relaxation of the process of drawing points, lines and curves into a pixel raster. Our approach arises from the observation that rasterising a pixel in an image given parameters of a primitive can be reformulated in terms of the primitive's distance transform, and then relaxed to allow the primitive's parameters to be learned. This relaxation allows end-to-end differentiable programs and deep networks to be learned and optimised and provides several building blocks that allow control over how a compositional drawing process is modelled. We emphasise the bottom-up nature of our proposed approach, which allows for drawing operations to be composed in ways that can mimic the physical reality of drawing rather than being tied to, for example, approaches in modern computer graphics. With the proposed approach we demonstrate how sketches can be generated by directly optimising against photographs and how auto-encoders can be built to transform rasterised handwritten digits into vectors without supervision. Extensive experimental results highlight the power of this approach under different modelling assumptions for drawing tasks.

For agents

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

get_harvested_code_for_paper("2103.16194")
get_code_for_paper("2103.16194")
have("2103.16194")

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

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

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

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

Connect an agent — have() is free.