SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2507.06161 · ICML · 2025

Sinkhorn Normalization of Diffusion Kernels

Jean Feydy, Nathan Kessler, Robin Magnet

arXiv · PDF · Open in the Atlas

Code that ran

18 of 26 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; 4 honoured the contract we drafted, 3 violated it and 0 have no contract verdict; 11 failures of our instrument; 8 no recorded run), measured 2026-11-23; 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/2507.06161.json · badge: /api/ran/2507.06161.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
RobinMagnet/SinkhornKernels canonical (classifier label)
classifier basis: census
18 ran · 8 no recorded run
FunctionStatusWhere it lives
boundary_mask Ran
ran, violated the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/grid.py
code served (permissive licence) · get_code("c6e121a7cc18e83d")
How it ran

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

# Create a small 3D occupancy mask for testing
# Use a simple shape with some interior and boundary voxels
mask_3d = np.array([
    [[0, 0, 0, 0],
     [0, 1, 1, 0],
     [0, 1, 1, 0],
     [0, 0, 0, 0]],
    
    [[0, 0, 0, 0],
     [0, 1, 1, 0],
     [0, 1, 1, 0],
     [0, 0, 0, 0]],
    
    [[0, 0, 0, 0],
     [0, 1, 1, 0],
     [0, 1, 1, 0],
     [0, 0, 0, 0]],
    
    [[0, 0, 0, 0],
     [0, 0, 0, 0],
     [0, 0, 0, 0],
     [0, 0, 0, 0]]
], dtype=bool)

ARGS = {
    "mask": mask_3d
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (4, 4, 4) — shape (4, 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
diffusion_eigsh Ran
ran; our contract draft was wrong, not the code
RobinMagnet/SinkhornKernels/sinkhornkernels/spectral.py
code served (permissive licence) · get_code("86ea67e604b3833d")
How it ran

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

import numpy as np
from scipy.sparse.linalg import LinearOperator
import scipy.sparse as sparse

# Create a small diffusion operator as a LinearOperator
# The function uses Q.shape[0], Q @ x operations, and getattr(Q, 'dtype', ...), getattr(Q, 'self_adjoint_measure', None)

N = 6
k = 3

# Create a simple diffusion-like matrix (symmetric, positive eigenvalues)
# We'll use a small random symmetric matrix with positive eigenvalues
np.random.seed(0)
base_matrix = np.random.randn(N, N)
symmetric_matrix = (base_matrix + base_matrix.T) / 2
# Shift to make eigenvalues positive
symmetric_matrix = symmetric_matrix + np.eye(N) * 3

class DiffusionOperator(LinearOperator):
    """Minimal LinearOperator that supports the required interface."""
    def __init__(self, matrix, measure):
        self.matrix = matrix
        self._measure = measure
        self.dtype = np.float64
        super().__init__(shape=(matrix.shape[0], matrix.shape[0]), dtype=self.dtype)
    
    @property
    def self_adjoint_measure(self):
        return self._measure
    
    def _matvec(self, x):
        return self.matrix @ x
    
    def _matmat(self, X):
        return self.matrix @ X

# Create a strictly positive measure (required by the function)
measure = np.abs(np.random.randn(N)) + 1.0

# Construct the operator
Q = DiffusionOperator(symmetric_matrix, measure)

ARGS = {
    'Q': Q,
    'k': k,
    'measure': None,  # Will use Q.self_adjoint_measure
    'which': 'LM',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
face_areas Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RobinMagnet/SinkhornKernels/sinkhornkernels/mesh.py
code served (permissive licence) · get_code("a4ab8b9eac9773fd")
How it ran

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

# Create a simple mesh with 4 vertices and 2 triangular faces
vertices = np.array([
    [0.0, 0.0, 0.0],
    [1.0, 0.0, 0.0],
    [0.0, 1.0, 0.0],
    [0.0, 0.0, 1.0]
], dtype=np.float32)

# Define 2 faces, each referencing 3 vertex indices
faces = np.array([
    [0, 1, 2],
    [0, 1, 3]
], dtype=np.int32)

ARGS = {
    "vertices": vertices,
    "faces": faces
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (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
from_basis Ran
ran; our contract draft was wrong, not the code
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/nn.py
code served (permissive licence) · get_code("88bcffe545b25c00")
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 (4, 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 as th

th.manual_seed(0)

# The function performs: th.matmul(basis, values)
# basis and values are both tensors that need compatible shapes for matmul
# basis should be shape (..., m, n) and values should be shape (..., n, k) or (n,)
# to produce output of shape (..., m, k) or (..., m)

# Create basis: shape (4, 3) - represents a 4-dimensional space with 3 basis vectors
basis = th.randn(4, 3)

# Create values: shape (3, 2) - coefficients for the 3 basis vectors, batch of 2
values = th.randn(3, 2)

ARGS = {
    "values": values,
    "basis": basis,
}
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 (4, 2) — shape (4, 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
gaussian_kernel Ran
ran, honoured the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/kernels.py
code served (permissive licence) · get_code("ca1dbb9dd33ed73d")
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 (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 numpy as np

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

# Create sample points data
# Using distinct dimensions: 5 points with 3 features each
points = np.random.randn(5, 3).astype(np.float32)

# Create sigma parameter
sigma = 1.5

# Define ARGS dict with all parameters for gaussian_kernel function
ARGS = {
    "points": points,
    "sigma": sigma,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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 (5, 5) — shape (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
gaussian_kernel_from_sqdist Ran
ran, violated the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/kernels.py
code served (permissive licence) · get_code("467f00ca09629fea")
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 scipy.sparse as sparse

# Create a small dense squared distance matrix
sqdist_dense = np.array([[0.0, 1.5, 2.5], 
                         [1.5, 0.0, 3.2],
                         [2.5, 3.2, 0.0]], dtype=np.float32)

# Create a small sparse squared distance matrix
sqdist_sparse = sparse.csr_matrix(
    np.array([[0.0, 1.5, 0.0],
              [1.5, 0.0, 3.2],
              [0.0, 3.2, 0.0]], dtype=np.float32)
)

sigma = 1.0

ARGS = {
    "sqdist": sqdist_dense,
    "sigma": sigma
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
gmm_effective_sigma2 Ran
ran; our contract draft was wrong, not the code
RobinMagnet/SinkhornKernels/sinkhornkernels/spectral.py
code served (permissive licence) · get_code("91f23c983a47701d")
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

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

# Define arguments for gmm_effective_sigma2
sigma = 1.5
N = 2  # number of components
d_ambient = 4  # ambient dimension
covariances = np.random.randn(N, d_ambient, d_ambient)
# Make covariances symmetric positive definite by using A @ A.T
covariances = np.array([cov @ cov.T for cov in covariances])
dim = 3  # intrinsic dimension (3 for volumes)
masses = np.array([0.4, 0.6])  # component weights

ARGS = {
    "sigma": sigma,
    "covariances": covariances,
    "dim": dim,
    "masses": masses,
}
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
grid_coordinates Ran
ran, honoured the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/grid.py
code served (permissive licence) · get_code("29e4deed4b3fc73e")
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 (6, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a small 3D boolean mask
mask = np.array([
    [[True, False, True],
     [False, True, False]],
    [[False, True, False],
     [True, False, True]]
])

# Define arguments
ARGS = {
    "mask": mask,
    "origin": 0.0,
    "spacing": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (6, 3) — shape (6, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
kde_masses Ran
ran, honoured the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/grid.py
code served (permissive licence) · get_code("83a52b7c9f043dd7")
How it ran

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

np.random.seed(0)

# Create a small boolean mask with distinct dimensions
# Using shape (4, 3, 2) to have clearly different dimensions
mask = np.random.rand(4, 3, 2) > 0.5  # Random boolean mask

# Sigma parameter - bandwidth in voxel units
sigma = 1.5

# Truncate parameter - controls how many standard deviations to use
truncate = 4.0

ARGS = {
    "mask": mask,
    "sigma": sigma,
    "truncate": truncate,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (17,) — shape (17,) 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
laplacian_eigenvalues Ran
ran, violated the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/spectral.py
code served (permissive licence) · get_code("dda4d69535593cdb")
How it ran

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

import numpy as np

# The function takes:
# 1. evals_Q: array-like of eigenvalues (will be converted to array and clipped)
# 2. sigma: scalar value (used in division and exponentiation)

# Create small sample eigenvalues for a diffusion operator
# Eigenvalues should be in (0, 1] range typically
evals_Q = np.array([0.9, 0.7, 0.5, 0.3, 0.1])

# Create a reasonable sigma value
# sigma represents sqrt(sigma^2/2) from heat kernel correspondence
sigma = 0.5

ARGS = {
    "evals_Q": evals_Q,
    "sigma": sigma,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (5,) — shape (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
load_obj Ran
ran; our contract draft was wrong, not the code
RobinMagnet/SinkhornKernels/sinkhornkernels/mesh.py
code served (permissive licence) · get_code("d01a9669173bb787")
How it ran

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

import numpy as np
import tempfile
import os

# Create a temporary OBJ file for testing
temp_dir = tempfile.mkdtemp()
obj_path = os.path.join(temp_dir, "test_mesh.obj")

# Write a simple valid OBJ file with a triangle mesh
obj_content = """# Simple triangle mesh
v 0.0 0.0 0.0
v 1.0 0.0 0.0
v 0.0 1.0 0.0
v 0.0 0.0 1.0
f 1 2 3
f 1 2 4
"""

with open(obj_path, 'w') as f:
    f.write(obj_content)

ARGS = {
    'path': obj_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_surface Ran
ran; our contract draft was wrong, not the code
RobinMagnet/SinkhornKernels/sinkhornkernels/mesh.py
code served (permissive licence) · get_code("92fd00512f9bcbd3")
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 (5, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a simple mesh with 4 vertices forming 2 triangles
vertices = np.array([
    [0.0, 0.0, 0.0],
    [1.0, 0.0, 0.0],
    [0.0, 1.0, 0.0],
    [1.0, 1.0, 0.0],
], dtype=np.float64)

# Define 2 triangular faces
faces = np.array([
    [0, 1, 2],
    [1, 3, 2],
], dtype=np.int32)

# Number of samples to generate
n_samples = 5

# Random number generator seed
rng = np.random.default_rng(42)

ARGS = {
    "vertices": vertices,
    "faces": faces,
    "n_samples": n_samples,
    "rng": rng,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (5, 3) — shape (5, 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
sinkhorn_log Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RobinMagnet/SinkhornKernels/sinkhornkernels/sinkhorn.py
code served (permissive licence) · get_code("b9ddc0ef26fea246")
How it ran

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

import numpy as np

# Create a small squared distance matrix (4x4)
N = 4
np.random.seed(0)
sqdist = np.random.rand(N, N) ** 2
sqdist = (sqdist + sqdist.T) / 2  # Make symmetric

# Create masses (positive weights)
masses = np.array([0.2, 0.3, 0.3, 0.2])

# Create initial log-potentials for warm-start
f_init = np.zeros(N)

ARGS = {
    'sqdist': sqdist,
    'sigma': 0.5,
    'masses': masses,
    'kernel': 'gaussian',
    'n_iter': 10,
    'tol': 1e-4,
    'f_init': f_init,
    'full_output': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sinkhorn_log Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/sinkhorn.py
code served (permissive licence) · get_code("51ff764c6a0dc428")
How it ran

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

import torch as th
import torch.nn as nn

th.manual_seed(0)

# Construct small test tensors
B = 2  # batch size
N = 3  # number of points
d = 4  # embedding dimension
p = 2  # number of scales

points = th.randn(B, N, d)
sigmas = th.randn(p).abs() + 0.1  # ensure positive
masses = th.ones(B, N)

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

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

import numpy as np
import scipy.sparse as sparse

# Create a small symmetric log-kernel matrix (dense case)
np.random.seed(0)
N = 4
log_kernel_dense = np.random.randn(N, N)
log_kernel_dense = (log_kernel_dense + log_kernel_dense.T) / 2  # make symmetric

# Create a sparse symmetric log-kernel matrix
log_kernel_sparse = sparse.random(N, N, density=0.5, format='csr', random_state=0)
log_kernel_sparse = log_kernel_sparse + log_kernel_sparse.T  # make symmetric

# Create masses (optional, must sum to positive values)
masses = np.array([1.0, 1.5, 1.2, 0.8])

# Create initial f values
f_init = np.random.randn(N)

ARGS = {
    'log_kernel': log_kernel_dense,
    'masses': masses,
    'n_iter': 5,
    'tol': 1e-4,
    'include_diagonal': False,
    'f_init': f_init,
    'full_output': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sinkhorn_log_sparse Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
RobinMagnet/SinkhornKernels/sinkhornkernels/sinkhorn.py
code served (permissive licence) · get_code("052ac7d02d5349d1")
How it ran

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

import numpy as np
import scipy.sparse as sparse

# Create a small sparse squared distance matrix
# N=5 points, store off-diagonal entries with some sparsity pattern
N = 5
row_indices = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4])
col_indices = np.array([1, 2, 0, 3, 0, 4, 1, 4, 2, 3])
sqdist_values = np.array([0.5, 1.2, 0.5, 0.8, 1.2, 0.9, 0.8, 1.1, 0.9, 1.1])
sqdist = sparse.csr_matrix((sqdist_values, (row_indices, col_indices)), shape=(N, N))

# Parameters
sigma = 0.5
masses = np.array([1.0, 1.0, 1.0, 1.0, 1.0])
kernel = 'gaussian'
n_iter = 10
tol = 1e-4
include_diagonal = True
f_init = None
full_output = False

ARGS = {
    'sqdist': sqdist,
    'sigma': sigma,
    'masses': masses,
    'kernel': kernel,
    'n_iter': n_iter,
    'tol': tol,
    'include_diagonal': include_diagonal,
    'f_init': f_init,
    'full_output': full_output,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (5,) — shape (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
squared_distances Ran
ran, honoured the contract we drafted
RobinMagnet/SinkhornKernels/sinkhornkernels/kernels.py
code served (permissive licence) · get_code("243a2cb1ed6e0e73")
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 (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from scipy.spatial.distance import cdist

# Create small distinct-sized arrays for X and Y
X = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=np.float32)

Y = np.array([
    [0.5, 1.5, 2.5, 3.5],
    [4.5, 5.5, 6.5, 7.5],
    [9.0, 10.0, 11.0, 12.0]
], dtype=np.float32)

ARGS = {
    'X': X,
    'Y': Y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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 (2, 3) — shape (2, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
to_basis Ran
ran; our contract draft was wrong, not the code
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/nn.py
code served (permissive licence) · get_code("b5a20f4d0584bdc0")
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, 5, 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 as th
import torch.nn as nn

th.manual_seed(0)

# Create small tensors with distinct dimensions
# values: (B, N, C) - batch 2, spatial 4, channels 3
values = th.randn(2, 4, 3)

# basis: (B, N, K) - batch 2, spatial 4, basis_dim 5
basis = th.randn(2, 4, 5)

# massvec: (N,) - spatial dimension 4, mass weights
massvec = th.randn(4)

ARGS = {
    "values": values,
    "basis": basis,
    "massvec": massvec,
}
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, 5, 3) — shape (2, 5, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_gaussian Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/diffusion.py
code served (permissive licence) · get_code("bb8bc52d56933dea")
How it ran

no invocation recorded.

apply_gaussian_dense Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/diffusion.py
code served (permissive licence) · get_code("bb52d3e06f0aa535")
How it ran

no invocation recorded.

apply_gaussian_keops Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/diffusion.py
code served (permissive licence) · get_code("fef0168a4fd77933")
How it ran

no invocation recorded.

exponential_diffusion Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/operators.py
code served (permissive licence) · get_code("5006a11c61f6318f")
How it ran

no invocation recorded.

gaussian_diffusion Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/operators.py
code served (permissive licence) · get_code("d2086bb4b74cb9e3")
How it ran

no invocation recorded.

gmm_diffusion Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/operators.py
code served (permissive licence) · get_code("ded0837330fa6f0b")
How it ran

no invocation recorded.

sinkhorn_log_dense Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/sinkhorn.py
code served (permissive licence) · get_code("21fbaffa2f3d7fda")
How it ran

no invocation recorded.

sinkhorn_log_dense_from_sqdist Not yet run
unverified (harvested, no recorded run)
RobinMagnet/SinkhornKernels/sinkhornkernels/torch/sinkhorn.py
code served (permissive licence) · get_code("5459f1845a9f1e43")
How it ran

no invocation recorded.

Also present in other papers' code

Of 26 samples lifted from this paper's linked repositories, 26 carry a function identity and 0 do not. Of the 26 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 26 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.

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

Smoothing a signal based on local neighborhoods is a core operation in machine learning and geometry processing. On well-structured domains such as vector spaces and manifolds, the Laplace operator derived from differential geometry offers a principled approach to smoothing via heat diffusion, with strong theoretical guarantees. However, constructing such Laplacians requires a carefully defined domain structure, which is not always available. Most practitioners thus rely on simple convolution kernels and message-passing layers, which are biased against the boundaries of the domain. We bridge this gap by introducing a broad class of smoothing operators, derived from general similarity or adjacency matrices, and demonstrate that they can be normalized into diffusion-like operators that inherit desirable properties from Laplacians. Our approach relies on a symmetric variant of the Sinkhorn algorithm, which rescales positive smoothing operators to match the structural behavior of heat diffusion. This construction enables Laplacian-like smoothing and processing of irregular data such as point clouds, sparse voxel grids or mixture of Gaussians. We show that the resulting operators not only approximate heat diffusion but also retain spectral information from the Laplacian itself, with applications to shape analysis and matching. Code is available at github.com/RobinMagnet/SinkhornKernels

For agents

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

get_harvested_code_for_paper("2507.06161")
get_code_for_paper("2507.06161")
have("2507.06161")

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

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

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

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

Connect an agent — have() is free.