SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1904.12785 · 2019

Style Transfer by Relaxed Optimal Transport and Self-Similarity

arXiv · PDF · Open in the Atlas

Code that ran

10 of 11 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 8 have no contract verdict; 2 failures of our instrument; 1 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/1904.12785.json · badge: /api/ran/1904.12785.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
winfried-loetzsch/wise community (classifier label)
classifier basis not recorded on the link
5 ran · 0 no recorded run
RElbers/strotss-pytorch community (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
bekkermans/style_transfer community (classifier label)
classifier basis not recorded on the link
2 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_pj Ran
ran; our contract draft was wrong, not the code
winfried-loetzsch/wise/helpers/hist_layers.py
code served (permissive licence) · get_code("4e62567232c0f363")
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)

# Analyze the function compute_pj:
# - x: tensor, used with .device, .size(0), .reshape, .repeat
# - K: int, used in torch.arange(K) and .view(-1, 1)
# - L: numeric, used in arithmetic
# - W: numeric, used in arithmetic

# Create a small batch of input data
# x should be a 2D tensor with shape (batch_size, features)
x = torch.randn(2, 4)  # batch_size=2, features=4

# K is the number of basis functions
K = 3

# L is a length parameter
L = 1.0

# W is a width parameter
W = 0.5

ARGS = {
    "x": x,
    "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
downscale Ran
ran on a synthesized input
RElbers/strotss-pytorch/python/util.py
code served (permissive licence) · get_code("a4a46bef4e8170de")
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, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small 4D tensor for interpolation (bilinear expects 4D: batch, channels, height, width)
# Using distinct sizes: batch=2, channels=4, height=3, width=5
x = torch.randn(2, 4, 3, 5)

# Create a downscale factor
factor = 2

ARGS = {
    'x': x,
    'factor': 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 Tensor, ndim 4, dtype family float, shape (2, 4, 1, 2) — shape (2, 4, 1, 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_individual_syle_weight Ran
ran on a synthesized input
winfried-loetzsch/wise/helpers/losses.py
code served (permissive licence) · get_code("edbcdd31ce12f58c")
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 expects gram_matrices to be an iterable of tensors
# It computes the norm of each gram matrix and averages them
# Gram matrices are typically square matrices representing style features

gram_matrix_1 = torch.randn(4, 4)
gram_matrix_2 = torch.randn(4, 4)
gram_matrix_3 = torch.randn(4, 4)

gram_matrices = [gram_matrix_1, gram_matrix_2, gram_matrix_3]

ARGS = {
    "gram_matrices": gram_matrices
}
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
gram_matrix Ran
ran on a synthesized input
winfried-loetzsch/wise/helpers/losses.py
code served (permissive licence) · get_code("a59f6e63a2e37d46")
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, 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 input tensor of shape (a, b, c, d)
# It computes a gram matrix by reshaping to (a, b, c*d) and doing matrix multiply
# The result is normalized by b*c*d

# Create a small 4D tensor with distinct dimensions for probing
# shape: (batch=2, channels=4, height=3, width=5)
input_tensor = torch.randn(2, 4, 3, 5)

ARGS = {
    "input": input_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 Tensor, ndim 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
l1_loss_ignore_minus_one Ran
ran; our contract draft was wrong, not the code
winfried-loetzsch/wise/helpers/losses.py
code served (permissive licence) · get_code("a80ace7c84ac85a4")
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.nn.functional import mse_loss, l1_loss

torch.manual_seed(0)

# Create small tensors for prediction and target
# Both should have the same shape
batch_size = 2
dim = 4

prediction = torch.randn(batch_size, dim)
target = torch.randn(batch_size, dim)

# Ensure some values in target are >= -0.5 and some are < -0.5
# to test the conditional behavior
target[0, 0] = 0.5  # >= -0.5, will be included in loss
target[0, 1] = -0.3  # >= -0.5, will be included in loss
target[1, 0] = -1.0  # < -0.5, will be zeroed out
target[1, 1] = -0.6  # < -0.5, will be zeroed out

ARGS = {
    "prediction": prediction,
    "target": target,
}
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
load_image Ran
ran on a synthesized input
bekkermans/style_transfer/utils.py
code served (permissive licence) · get_code("9cbf559fc8ce1028")
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 (1, 3, 512, 512) 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
import tempfile
import cv2

# Create a temporary test image file
with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as tmp:
    # Create a simple RGB image (256x256x3)
    test_image = np.random.randint(0, 255, (256, 256, 3), dtype=np.uint8)
    # OpenCV uses BGR format, so create BGR image
    test_image_bgr = cv2.cvtColor(test_image, cv2.COLOR_RGB2BGR)
    cv2.imwrite(tmp.name, test_image_bgr)
    image_path = tmp.name

ARGS = {
    "path": image_path,
    "size": 512
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, 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 (1, 3, 512, 512) — shape (1, 3, 512, 512) 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
numpy_to_tensor Ran
ran on a synthesized input
bekkermans/style_transfer/utils.py
code served (permissive licence) · get_code("94102c561faf5193")
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 (1, 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
import numpy as np

torch.manual_seed(0)

# The function takes an image parameter that should be a numpy array
# It expects shape (height, width, channels) based on the transpose operation
# Let's create a small numpy array with distinct dimensions for clarity

image = np.random.randn(4, 3, 2).astype(np.float32)  # height=4, width=3, channels=2

ARGS = {
    "image": image
}
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 (1, 2, 4, 3) — shape (1, 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
phi_k Ran
ran on a synthesized input
winfried-loetzsch/wise/helpers/hist_layers.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
resize_like Ran
ran on a synthesized input
RElbers/strotss-pytorch/python/util.py
code served (permissive licence) · get_code("c4d408bb8f3c70bf")
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, 6, 7) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

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

torch.manual_seed(0)

# Create two tensors with distinct spatial dimensions
# x: batch=2, channels=4, height=3, width=5
x = torch.randn(2, 4, 3, 5)

# other: batch=2, channels=4, height=6, width=7
other = torch.randn(2, 4, 6, 7)

ARGS = {
    'x': x,
    'other': other
}
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, 6, 7) — shape (2, 4, 6, 7) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rgb_to_yuv Ran
ran on a synthesized input
RElbers/strotss-pytorch/python/util.py
code served (permissive licence) · get_code("7ef253683f121ca7")
How it ran

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

import torch

torch.manual_seed(0)

# The function rgb_to_yuv expects an rgb tensor
# Looking at the function body:
# - rgb.shape is accessed
# - rgb.device is accessed
# - rgb is flattened and transposed
# - matrix multiplication is performed with w (3x3 matrix)
# - The tensor needs to have shape compatible with the operations

# For an RGB image, typical shape is (batch, channels, height, width) or (batch, height, width, channels)
# Given the flatten(-2, -1) operation (flattens last 2 dims) and transpose, 
# the input should have at least 3 dimensions

# Let's create a small RGB tensor with shape (batch=2, channels=3, height=4, width=4)
# This represents 2 RGB images of 4x4 pixels each
rgb = torch.randint(0, 256, (2, 3, 4, 4), dtype=torch.float32)

ARGS = {
    "rgb": rgb
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 4, 4) — shape (2, 3, 4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
strotss_loss Not yet run
unverified (harvested, no recorded run)
RElbers/strotss-pytorch/python/loss.py
code served (permissive licence) · get_code("da52a2406e65035b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 1 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
phi_k 2 other papers
1 dated earlier, 1 later
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
aaai_27987 (2024 (year only))
Optimize & Reduce: A Top-Down Approach for Image Vectorization
compute_pj 1 other paper
1 dated earlier
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
get_individual_syle_weight 1 other paper
1 dated earlier
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
gram_matrix 1 other paper
1 dated earlier
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
l1_loss_ignore_minus_one 1 other paper
1 dated earlier
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution

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

Style transfer algorithms strive to render the content of one image using the style of another. We propose Style Transfer by Relaxed Optimal Transport and Self-Similarity (STROTSS), a new optimization-based style transfer algorithm. We extend our method to allow user-specified point-to-point or region-to-region control over visual similarity between the style image and the output. Such guidance can be used to either achieve a particular visual effect or correct errors made by unconstrained style transfer. In order to quantitatively compare our method to prior work, we conduct a large-scale user study designed to assess the style-content tradeoff across settings in style transfer algorithms. Our results indicate that for any desired level of content preservation, our method provides higher quality stylization than prior work. Code is available at https://github.com/nkolkin13/STROTSS

For agents

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

get_harvested_code_for_paper("1904.12785")
get_code_for_paper("1904.12785")
have("1904.12785")

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

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

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

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

Connect an agent — have() is free.