SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1703.07737 · 2017

In Defense of the Triplet Loss for Person Re-Identification

arXiv · PDF · Open in the Atlas

Code that ran

39 of 46 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; 10 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 27 failures of our instrument; 7 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/1703.07737.json · badge: /api/ran/1703.07737.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
VisualComputingInstitute/triplet-reid canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
AsuradaYuci/tripletreid-zhushi community (classifier label)
classifier basis not recorded on the link
11 ran · 3 no recorded run
BarbaAlGhul/recommender-system-thesis community (classifier label)
classifier basis not recorded on the link
8 ran · 2 no recorded run
tbmoon/facenet community (classifier label)
classifier basis not recorded on the link
7 ran · 2 no recorded run
thomas-liao/diva_tracking_reid community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
jjmachan/DeepHash community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
adambielski/siamese-triplet reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
IcewineChen/mxnet-batch_hard_triplet_loss community (classifier label)
classifier basis not recorded on the link
1 ran · 0 no recorded run
FunctionStatusWhere it lives
all_diffs Ran
ran, honoured the contract we drafted
thomas-liao/diva_tracking_reid/loss.py
code served (permissive licence) · get_code("8427c7e156becb53")
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 EagerTensor, 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 tensorflow as tf

# Create two 2D tensors for testing
# a: batch size 2, feature dimension 4
a = tf.constant([[1.0, 2.0, 3.0, 4.0],
                 [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)

# b: batch size 3, feature dimension 4
b = tf.constant([[0.5, 1.0, 1.5, 2.0],
                 [2.5, 3.0, 3.5, 4.0],
                 [4.5, 5.0, 5.5, 6.0]], dtype=tf.float32)

ARGS = {
    'a': a,
    'b': b
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
all_diffs Ran
ran, honoured the contract we drafted
AsuradaYuci/tripletreid-zhushi/loss.py
code served (permissive licence) · get_code("cab57693e7555782")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create two 2D tensors with different batch sizes but same feature dimension
# a: shape (2, 4) - batch of 2 vectors with 4 features
# b: shape (3, 4) - batch of 3 vectors with 4 features
a = tf.constant([[1.0, 2.0, 3.0, 4.0], 
                 [5.0, 6.0, 7.0, 8.0]], dtype=tf.float32)

b = tf.constant([[0.5, 1.5, 2.5, 3.5],
                 [4.5, 5.5, 6.5, 7.5],
                 [8.5, 9.5, 10.5, 11.5]], dtype=tf.float32)

ARGS = {
    'a': a,
    'b': b
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
average_precision_score_market Ran
ran, honoured the contract we drafted
VisualComputingInstitute/triplet-reid/evaluate.py
code served (permissive licence) · get_code("82445be81c67abf4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned float64, 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 numpy as np

# Create a simple test case for person re-identification scenario
# y_true: binary labels indicating if a retrieved sample matches the query (1) or not (0)
# y_score: predicted similarity scores for each sample

# Example: 10 samples, 3 are true matches
y_true = np.array([1, 0, 1, 0, 0, 1, 0, 0, 0, 0])
y_score = np.array([0.9, 0.8, 0.75, 0.6, 0.55, 0.5, 0.4, 0.3, 0.2, 0.1])

ARGS = {
    'y_true': y_true,
    'y_score': y_score
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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, 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
calculate_accuracy Ran
ran, honoured the contract we drafted
tbmoon/facenet/eval_metrics.py
pointer only (licence: MIT); the stored copy get_code serves, from zrui94/insight_mx, is pointer only (licence: NONE) · get_code("f975336b5d5f1a80")
How it ran

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

calculate_roc Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tbmoon/facenet/eval_metrics.py
code served (permissive licence) · get_code("ecb40e2478acb33f")
How it ran

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

import numpy as np
from sklearn.model_selection import KFold

np.random.seed(0)

# Create sample data for the function
nrof_pairs = 20
nrof_thresholds = 5

# distances: array of distances between pairs
distances = np.random.rand(nrof_pairs).astype(np.float32)

# labels: binary array indicating if pairs are same (1) or different (0)
labels = np.random.randint(0, 2, nrof_pairs).astype(bool)

# thresholds: array of threshold values to test
thresholds = np.linspace(0.0, 1.0, nrof_thresholds)

# nrof_folds: number of folds for cross-validation
nrof_folds = 5

ARGS = {
    'thresholds': thresholds,
    'distances': distances,
    'labels': labels,
    'nrof_folds': nrof_folds
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cdist Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thomas-liao/diva_tracking_reid/loss.py
code served (permissive licence) · get_code("3dbcae6ca6415ede")
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 EagerTensor, 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 tensorflow as tf

# Create small 2D tensors with distinct dimensions
# a: (B1=2, F=4), b: (B2=3, F=4)
a = tf.constant([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=tf.float32)

b = tf.constant([
    [1.5, 2.5, 3.5, 4.5],
    [5.5, 6.5, 7.5, 8.5],
    [0.5, 1.5, 2.5, 3.5]
], dtype=tf.float32)

metric = 'euclidean'

ARGS = {
    'a': a,
    'b': b,
    'metric': metric
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
cdist Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AsuradaYuci/tripletreid-zhushi/loss.py
code served (permissive licence) · get_code("ffe848e860beaf70")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

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

# Create small test tensors
# a: shape (B1=2, F=4) - 2 vectors of dimension 4
a = tf.constant([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=tf.float32)

# b: shape (B2=3, F=4) - 3 vectors of dimension 4
b = tf.constant([
    [1.5, 2.5, 3.5, 4.5],
    [2.0, 3.0, 4.0, 5.0],
    [0.5, 1.5, 2.5, 3.5]
], dtype=tf.float32)

# metric parameter - test with 'euclidean'
metric = 'euclidean'

ARGS = {
    'a': a,
    'b': b,
    'metric': metric
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
check_directory Ran
ran; our contract draft was wrong, not the code
AsuradaYuci/tripletreid-zhushi/common.py
code served (permissive licence) · get_code("119574482993a7b8")
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 str. 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 os
import tempfile
from argparse import ArgumentTypeError

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()
temp_subdir = os.path.join(temp_dir, "subdir")
os.makedirs(temp_subdir, exist_ok=True)

# Create a valid writeable path argument
valid_writeable_path = temp_subdir

# Create a valid writeable path that doesn't exist yet (parent exists and is writeable)
nonexistent_writeable_path = os.path.join(temp_subdir, "newdir")

ARGS = {
    'arg': valid_writeable_path,
    'access': os.W_OK,
    'access_str': 'writeable'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
check_directory Ran
ran; our contract draft was wrong, not the code
thomas-liao/diva_tracking_reid/common.py
code served (permissive licence) · get_code("44a92853a18a9115")
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 str. 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 os
import tempfile

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()
writeable_subdir = os.path.join(temp_dir, 'writeable_test')
os.makedirs(writeable_subdir, exist_ok=True)

# Create a non-writeable directory by removing write permissions
non_writeable_dir = os.path.join(temp_dir, 'non_writeable')
os.makedirs(non_writeable_dir, exist_ok=True)
os.chmod(non_writeable_dir, 0o444)

ARGS = {
    'arg': writeable_subdir,
    'access': os.W_OK,
    'access_str': 'writeable'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
dcg_score Ran
ran; our contract draft was wrong, not the code
BarbaAlGhul/recommender-system-thesis/metrics.py
code served (permissive licence) · get_code("87856274c73e4919")
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 random seed for reproducibility
np.random.seed(0)

# Create sample data for y_true (ground truth relevance labels)
# Using small integer labels (0-3) for relevance
y_true = np.array([3, 2, 1, 0, 2, 1, 3, 0])

# Create sample data for y_score (predicted scores)
# Using random scores that will be sorted to rank documents
y_score = np.array([0.9, 0.7, 0.8, 0.3, 0.6, 0.5, 0.95, 0.2])

# Define ARGS with all required parameters
ARGS = {
    'y_true': y_true,
    'y_score': y_score,
    'k': 5,
    'gains': 'exponential'
}
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
find_dcg Ran
ran; our contract draft was wrong, not the code
BarbaAlGhul/recommender-system-thesis/metrics.py
code served (permissive licence) · get_code("3ebeec2cc2de528b")
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 float, 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 math

def find_dcg(element_list):
    """
    Discounted Cumulative Gain (DCG)
    The definition of DCG can be found in this paper:
        Azzah Al-Maskari, Mark Sanderson, and Paul Clough. 2007.
        "The relationship between IR effectiveness measures and user satisfaction."
    Parameters:
        element_list - a list of ranks Ex: [5,4,2,2,1]
    Returns:
        score
    """
    score = 0.0
    for order, rank in enumerate(element_list):
        score += float(rank) / math.log(order + 2)
    return score


ARGS = {
    "element_list": [5, 4, 2, 2, 1]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
flip_augment Ran
ran, honoured the contract we drafted
AsuradaYuci/tripletreid-zhushi/embed.py
code served (permissive licence) · get_code("cb19488564617e1e")
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 tensorflow as tf
import numpy as np

# Create a small image tensor (height=4, width=3, channels=1)
image = tf.constant(np.random.randn(4, 3, 1).astype(np.float32))

# Create scalar tensors for fid and pid
fid = tf.constant(0)
pid = tf.constant(1)

ARGS = {
    "image": image,
    "fid": fid,
    "pid": pid,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_at_indices Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
thomas-liao/diva_tracking_reid/loss.py
code served (permissive licence) · get_code("f6fa452e61831f1d")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create a 2D tensor with shape (2, 4) - batch size 2, 4 features
tensor = tf.constant([[1.0, 2.0, 3.0, 4.0],
                      [5.0, 6.0, 7.0, 8.0]])

# Create indices tensor with shape (2,) - one index per batch element
# Valid indices should be in range [0, 3] since tensor has 4 columns
indices = tf.constant([0, 2], dtype=tf.int32)

ARGS = {
    'tensor': tensor,
    'indices': indices
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
get_at_indices Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AsuradaYuci/tripletreid-zhushi/loss.py
code served (permissive licence) · get_code("4acfece13ca5c19a")
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 EagerTensor, ndim 1, dtype family int, 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 tensorflow as tf
import numpy as np

# Create a small 2D tensor (batch_size=2, num_features=4)
tensor = tf.constant([
    [10, 20, 30, 40],
    [50, 60, 70, 80]
], dtype=tf.int32)

# Create indices that point to valid column positions (must be < 4)
indices = tf.constant([1, 2], dtype=tf.int32)

ARGS = {
    "tensor": tensor,
    "indices": indices
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 1, dtype family int, 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
get_dataloader Ran
ran; our contract draft was wrong, not the code
tbmoon/facenet/data_loader.py
code served (permissive licence) · get_code("70087c59822847c9")
How it ran

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

import os
import tempfile
import numpy as np
import pandas as pd
import torch
from PIL import Image

torch.manual_seed(0)

# Create temporary directories and CSV files for testing
temp_dir = tempfile.mkdtemp()
train_dir = os.path.join(temp_dir, 'train')
valid_dir = os.path.join(temp_dir, 'valid')
os.makedirs(train_dir, exist_ok=True)
os.makedirs(valid_dir, exist_ok=True)

# Create sample face directories and images
for split_dir in [train_dir, valid_dir]:
    for person_name in ['person_0', 'person_1', 'person_2']:
        person_dir = os.path.join(split_dir, person_name)
        os.makedirs(person_dir, exist_ok=True)
        for img_id in range(3):
            img_path = os.path.join(person_dir, f'{img_id}.jpg')
            img = Image.new('RGB', (224, 224), color=(73, 109, 137))
            img.save(img_path)

# Create train CSV
train_data = {
    'class': [0, 0, 0, 1, 1, 1, 2, 2, 2],
    'id': [0, 1, 2, 0, 1, 2, 0, 1, 2],
    'name': ['person_0', 'person_0', 'person_0', 'person_1', 'person_1', 'person_1', 'person_2', 'person_2', 'person_2'],
    'ext': ['jpg'] * 9
}
train_df = pd.DataFrame(train_data)
train_csv_path = os.path.join(temp_dir, 'train.csv')
train_df.to_csv(train_csv_path, index=False)

# Create valid CSV
valid_data = {
    'class': [0, 0, 1, 1, 2, 2],
    'id': [0, 1, 0, 1, 0, 1],
    'name': ['person_0', 'person_0', 'person_1', 'person_1', 'person_2', 'person_2'],
    'ext': ['jpg'] * 6
}
valid_df = pd.DataFrame(valid_data)
valid_csv_path = os.path.join(temp_dir, 'valid.csv')
valid_df.to_csv(valid_csv_path, index=False)

ARGS = {
    'train_root_dir': train_dir,
    'valid_root_dir': valid_dir,
    'train_csv_name': train_csv_path,
    'valid_csv_name': valid_csv_path,
    'num_train_triplets': 4,
    'num_valid_triplets': 2,
    'batch_size': 2,
    'num_workers': 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, pandas, skimage, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_dir_and_file Ran
ran; our contract draft was wrong, not the code
tbmoon/facenet/mtcnn.py
code served (permissive licence) · get_code("127d42102f3bcc02")
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 str. 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 os
from pathlib import Path

# The function expects a path object with a .parts attribute
# It accesses parts[-2] and parts[-1], so we need a path with at least 2 components
path = Path("/home/user/documents/file.txt")

ARGS = {
    "path": path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
hardest_negative Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
jjmachan/DeepHash/utils.py
code served (permissive licence) · get_code("28431bd8429ef046")
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 int64, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The function takes loss_values and:
# 1. Calls np.argmax(loss_values) - needs array-like
# 2. Indexes into loss_values with the result
# 3. Compares the value to 0
# So loss_values should be a numpy array of numeric values

# Create a small numpy array with some positive and negative loss values
loss_values = np.array([0.5, -0.2, 1.3, 0.1])

ARGS = {
    "loss_values": loss_values
}
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 int64, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
identity_loss Ran
ran, honoured the contract we drafted
BarbaAlGhul/recommender-system-thesis/losses.py
code served (permissive licence) · get_code("cc6714cb88899d93")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create small tensors for y_true and y_pred
# y_true is ignored in the function, but we still need to provide it
# y_pred is used: tf.reduce_mean is called on it
y_true = tf.constant([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]])
y_pred = tf.constant([[0.1, 0.2, 0.3, 0.4], [0.5, 0.6, 0.7, 0.8]])

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
load Ran
ran; our contract draft was wrong, not the code
BarbaAlGhul/recommender-system-thesis/load_movies.py
code served (permissive licence) · get_code("240b69380724f6e4")
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 DataFrame. 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 pandas as pd
import tempfile
import os

# Create a temporary directory with mock MovieLens data
temp_dir = tempfile.mkdtemp()
ml_dir = os.path.join(temp_dir, 'ml-latest-small')
os.makedirs(ml_dir, exist_ok=True)

# Create a minimal mock movies.csv file
movies_data = {
    'movieId': [1, 2, 3, 4, 5],
    'title': ['Toy Story (1995)', 'Jumanji (1995)', 'Grumpier Old Men (1995)', 'Waiting to Exhale (1995)', 'Father of the Bride Part II (1995)'],
    'genres': ['Adventure|Animation|Children|Comedy|Fantasy', 'Adventure|Children|Fantasy', 'Comedy|Romance', 'Comedy|Drama|Romance', 'Comedy']
}
movies_df = pd.DataFrame(movies_data)
movies_csv_path = os.path.join(ml_dir, 'movies.csv')
movies_df.to_csv(movies_csv_path, index=False)

ARGS = {
    'path': temp_dir + '/'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
load Ran
ran, honoured the contract we drafted
BarbaAlGhul/recommender-system-thesis/load_ratings.py
code served (permissive licence) · get_code("de12e26f4dd9eee4")
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 DataFrame. 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 pandas as pd
import tempfile
import os

# Create a temporary directory with a mock ratings.csv file
temp_dir = tempfile.mkdtemp()
ml_dir = os.path.join(temp_dir, 'ml-latest-small')
os.makedirs(ml_dir, exist_ok=True)

# Create a small mock ratings.csv file
ratings_data = {
    'userId': [1, 1, 2, 2, 3, 3],
    'movieId': [1, 2, 1, 3, 2, 3],
    'rating': [5.0, 4.0, 3.0, 5.0, 2.0, 4.0],
    'timestamp': [964982703, 964982703, 964982703, 964982703, 964982703, 964982703]
}
ratings_df = pd.DataFrame(ratings_data)
ratings_df.to_csv(os.path.join(ml_dir, 'ratings.csv'), index=False)

ARGS = {
    'path': temp_dir + '/'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
load_dat Ran
ran, honoured the contract we drafted
AsuradaYuci/tripletreid-zhushi/lbtoolbox.py
code served (permissive licence) · get_code("ec4f4037a31db0cb")
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 (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 json
import numpy as np
import tempfile
import os

# Create a temporary directory for test files
temp_dir = tempfile.mkdtemp()

# Create test data file and metadata
basename = os.path.join(temp_dir, "test_data")

# Define test array properties
test_dtype = "float32"
test_shape = (4, 3)
test_data = np.arange(12, dtype=test_dtype).reshape(test_shape)

# Write the actual data file
test_data.tofile(basename)

# Write the JSON metadata file
metadata = {
    "dtype": test_dtype,
    "shape": test_shape
}
with open(basename + '.json', 'w') as f:
    json.dump(metadata, f)

# Define arguments for load_dat
ARGS = {
    "basename": basename,
    "mode": "r"
}
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 (4, 3) — shape (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
load_dataset Ran
ran; our contract draft was wrong, not the code
IcewineChen/mxnet-batch_hard_triplet_loss/dataset.py
code served (permissive licence) · get_code("f0cb72e43bf6a71e")
How it ran

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

import numpy as np
import os
import tempfile

# Create a temporary directory and CSV file for testing
temp_dir = tempfile.mkdtemp()
csv_file = os.path.join(temp_dir, "dataset.csv")
image_root = os.path.join(temp_dir, "images") + "/"

# Create the image root directory
os.makedirs(image_root, exist_ok=True)

# Create some dummy image files
os.makedirs(os.path.join(image_root, "subdir"), exist_ok=True)
open(os.path.join(image_root, "subdir", "img1.jpg"), 'w').close()
open(os.path.join(image_root, "subdir", "img2.jpg"), 'w').close()

# Create a CSV file with person IDs and file IDs
csv_content = "pid1,subdir/img1.jpg\npid2,subdir/img2.jpg\n"
with open(csv_file, 'w') as f:
    f.write(csv_content)

ARGS = {
    "csv_file": csv_file,
    "image_root": image_root,
    "fail_on_missing": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
margin_comparator_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
BarbaAlGhul/recommender-system-thesis/losses.py
code served (permissive licence) · get_code("0721ce972ca2f5d4")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

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

# Create small sample tensors for the inputs
# positive_pair_sim: similarity scores for positive pairs (batch_size=2)
positive_pair_sim = tf.constant([0.8, 0.9], dtype=tf.float32)

# negative_pair_sim: similarity scores for negative pairs (batch_size=2)
negative_pair_sim = tf.constant([0.3, 0.4], dtype=tf.float32)

# Package inputs as a tuple (as expected by the function)
inputs = (positive_pair_sim, negative_pair_sim)

# Define margin parameter
margin = 1.0

# Construct the ARGS dictionary
ARGS = {
    "inputs": inputs,
    "margin": margin
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
mean Ran
ran, honoured the contract we drafted
AsuradaYuci/tripletreid-zhushi/aggregators.py
code served (permissive licence) · get_code("3d7c7885af720b02")
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 (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

# The function 'mean' takes embeddings (embs) and computes the mean along axis 0
# embs should be a numpy array with shape (batch_size, embedding_dim)

# Create a small embeddings array: shape (2, 4) - 2 samples, 4-dimensional embeddings
embs = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
])

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

import torch
import torch.nn as nn
from torchvision.models import resnet50

torch.manual_seed(0)

# Mock the load_state_dict_from_url function since we can't access network
def load_state_dict_from_url(url, progress=True):
    # Return a mock state dict with the expected structure
    model = resnet50(pretrained=False)
    state_dict = model.state_dict()
    
    # Create a mock classifier and fc layers
    state_dict['fc.1.weight'] = torch.randn(128, 100352)
    state_dict['fc.1.bias'] = torch.randn(128)
    state_dict['classifier.weight'] = torch.randn(500, 128)
    state_dict['classifier.bias'] = torch.randn(500)
    
    return {'state_dict': state_dict}

# Patch the import in the module
import sys
from unittest.mock import MagicMock

class MockModule:
    def load_state_dict_from_url(self, url, progress=True):
        return load_state_dict_from_url(url, progress)

# Define the classes and functions as they appear in the code
class Flatten(nn.Module):
    def forward(self, x):
        return x.view(x.size(0), -1)

class FaceNetModel(nn.Module):
    def __init__(self, pretrained=False):
        super(FaceNetModel, self).__init__()
        self.model = resnet50(pretrained)
        embedding_size = 128
        num_classes = 500
        self.cnn = nn.Sequential(self.model.conv1, self.model.bn1, self.model.relu, self.model.maxpool, self.model.layer1, self.model.layer2, self.model.layer3, self.model.layer4)
        self.model.fc = nn.Sequential(Flatten(), nn.Linear(100352, embedding_size))
        self.model.classifier = nn.Linear(embedding_size, num_classes)

    def l2_norm(self, input):
        input_size = input.size()
        buffer = torch.pow(input, 2)
        normp = torch.sum(buffer, 1).add_(1e-10)
        norm = torch.sqrt(normp)
        _output = torch.div(input, norm.view(-1, 1).expand_as(input))
        output = _output.view(input_size)
        return output

    def freeze_all(self):
        for param in self.model.parameters():
            param.requires_grad = False

    def unfreeze_all(self):
        for param in self.model.parameters():
            param.requires_grad = True

    def freeze_fc(self):
        for param in self.model.fc.parameters():
            param.requires_grad = False

    def unfreeze_fc(self):
        for param in self.model.fc.parameters():
            param.requires_grad = True

    def freeze_only(self, freeze):
        for name, child in self.model.named_children():
            if name in freeze:
                for param in child.parameters():
                    param.requires_grad = False
            else:
                for param in child.parameters():
                    param.requires_grad = True

    def unfreeze_only(self, unfreeze):
        for name, child in self.model.named_children():
            if name in unfreeze:
                for param in child.parameters():
                    param.requires_grad = True
            else:
                for param in child.parameters():
                    param.requires_grad = False

    def forward(self, x):
        x = self.cnn(x)
        x = self.model.fc(x)
        features = self.l2_norm(x)
        alpha = 10
        features = features * alpha
        return features

    def forward_classifier(self, x):
        features = self.forward(x)
        res = self.model.classifier(features)
        return res

model_urls = dict(acc_920='https://github.com/khrlimam/facenet/releases/download/acc-0.920/model920-6be7e3e9.pth', acc_921='https://github.com/khrlimam/facenet/releases/download/acc-0.92135/model921-af60fb4f.pth')

def load_state(arch, progress=True):
    state = load_state_dict_from_url(model_urls.get(arch), progress=progress)
    return state

def model_920(pretrained=True, progress=True):
    model = FaceNetModel()
    if pretrained:
        state = load_state('acc_920', progress)
        model.load_state_dict(state['state_dict'])
    return model

ARGS = {
    'pretrained': False,
    'progress': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FaceNetModel — a FaceNetModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FaceNetModel 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
model_921 Ran
ran; our contract draft was wrong, not the code
tbmoon/facenet/models.py
code served (permissive licence) · get_code("e67e3d8709640b1d")
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 FaceNetModel. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torchvision.models import resnet50

torch.manual_seed(0)

# Mock the load_state_dict_from_url function since we can't do actual downloads
def load_state_dict_from_url(url, progress=True):
    # Return a mock state dict with the expected structure
    return {'state_dict': {}}

# Patch the function into the module scope
import sys
current_module = sys.modules[__name__]
current_module.load_state_dict_from_url = load_state_dict_from_url

# Define ARGS for model_921 function
ARGS = {
    'pretrained': False,  # Set to False to avoid attempting downloads
    'progress': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FaceNetModel — a FaceNetModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FaceNetModel 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
ndcg_score Ran
ran; our contract draft was wrong, not the code
BarbaAlGhul/recommender-system-thesis/metrics.py
code served (permissive licence) · get_code("97c2bad5618d999e")
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 random seed for reproducibility
np.random.seed(0)

# Create sample data for NDCG score calculation
# y_true: ground truth relevance labels (higher is more relevant)
y_true = np.array([3, 2, 3, 0, 1, 2])

# y_score: predicted scores from the model
y_score = np.array([0.9, 0.8, 0.7, 0.6, 0.5, 0.4])

# k: rank cutoff for evaluation
k = 10

# gains: type of gains calculation
gains = 'exponential'

# Construct ARGS dictionary with all parameters
ARGS = {
    'y_true': y_true,
    'y_score': y_score,
    'k': k,
    'gains': gains
}
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
pdist Ran
ran, honoured the contract we drafted
jjmachan/DeepHash/utils.py
pointer only (licence: BSD-3-Clause); the stored copy get_code serves, from PeiqinZhuang/API-Net, is pointer only (licence: NONE) · get_code("21868b96f7d7b0a3")
How it ran

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

random_hard_negative Ran
ran, violated the contract we drafted
jjmachan/DeepHash/utils.py
code served (permissive licence) · get_code("ac72a4aca5c29a4a")
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 int64, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

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

# Create a small array of loss values
# Some values > 0 (hard negatives), some <= 0
loss_values = np.array([0.5, -0.2, 1.3, 0.0, 2.1, -1.0])

ARGS = {
    "loss_values": loss_values
}
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 int64, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
readable_directory Ran
ran; our contract draft was wrong, not the code
AsuradaYuci/tripletreid-zhushi/common.py
code served (permissive licence) · get_code("6b0abcd1d16fa141")
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 str. 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 os
import tempfile

# Create a temporary directory that we can use for testing
temp_dir = tempfile.mkdtemp()

# Create a subdirectory to test with
test_dir = os.path.join(temp_dir, "test_readable_dir")
os.makedirs(test_dir, exist_ok=True)

# Ensure the directory is readable
os.chmod(test_dir, 0o755)

ARGS = {
    "arg": test_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
readable_directory Ran
ran; our contract draft was wrong, not the code
thomas-liao/diva_tracking_reid/common.py
code served (permissive licence) · get_code("3fed355ce4cc7002")
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 str. 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 os
import tempfile
from argparse import ArgumentTypeError

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Test case 1: valid readable directory (the temp directory itself is readable)
valid_readable_path = temp_dir

# Test case 2: a subdirectory path that doesn't exist yet but is under a writable parent
nonexistent_subdir = os.path.join(temp_dir, "subdir", "nested")

ARGS = {
    "arg": valid_readable_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
sample_triplets Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
BarbaAlGhul/recommender-system-thesis/sample_triplets.py
code served (permissive licence) · get_code("d4dd6ed08bb883ee")
How it ran

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

import numpy as np
import pandas as pd

class PosData:
    """Stand-in for a DataFrame-like object with userId and movieId columns"""
    def __init__(self, user_ids, movie_ids):
        self.userId = pd.Series(user_ids)
        self.movieId = pd.Series(movie_ids)
    
    @property
    def values(self):
        """Return values attribute for Series"""
        pass

# Create sample positive data
pos_data = pd.DataFrame({
    'userId': [1, 2, 3, 4],
    'movieId': [10, 20, 15, 25]
})

ARGS = {
    'pos_data': pos_data,
    'max_item_id': 100,
    'random_seed': 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
test_epoch Ran
ran; our contract draft was wrong, not the code
adambielski/siamese-triplet/trainer.py
code served (permissive licence) · get_code("3d7ea6c7a90b443f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

# Loss function
def loss_fn(outputs, target):
    return torch.nn.functional.mse_loss(outputs, target)

# Metric class
class SimpleMetric:
    def __init__(self):
        self.value = 0
        self.count = 0
    
    def reset(self):
        self.value = 0
        self.count = 0
    
    def __call__(self, outputs, target, loss_outputs):
        self.count += 1
        if target is not None and len(target) > 0:
            self.value += outputs[0].sum().item()

metrics = [SimpleMetric(), SimpleMetric()]

# Data loader - list of (data, target) tuples
val_loader = [
    (torch.randn(2, 4), torch.randn(2, 3)),
    (torch.randn(2, 4), torch.randn(2, 3)),
]

cuda = False

ARGS = {
    'val_loader': val_loader,
    'model': model,
    'loss_fn': loss_fn,
    'cuda': cuda,
    'metrics': metrics
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
train_epoch Ran
ran; our contract draft was wrong, not the code
adambielski/siamese-triplet/trainer.py
code served (permissive licence) · get_code("8e1349744be50b82")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np

torch.manual_seed(0)

# Simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.fc(x)

model = SimpleModel()

# Loss function
def loss_fn(outputs, target):
    return nn.functional.mse_loss(outputs, target)

# Optimizer
optimizer = optim.SGD(model.parameters(), lr=0.01)

# Train loader - list of (data, target) tuples
train_loader = [
    (torch.randn(2, 4), torch.randn(2, 3)),
    (torch.randn(2, 4), torch.randn(2, 3)),
    (torch.randn(2, 4), torch.randn(2, 3)),
]

# Add dataset attribute to train_loader
class TrainLoader:
    def __init__(self, data_list):
        self.data_list = data_list
        self.dataset = data_list  # For len(train_loader.dataset)
    
    def __iter__(self):
        return iter(self.data_list)
    
    def __len__(self):
        return len(self.data_list)

train_loader = TrainLoader(train_loader)

# Metric class
class DummyMetric:
    def __init__(self, metric_name):
        self.metric_name = metric_name
        self.val = 0.0
        self.count = 0
    
    def reset(self):
        self.val = 0.0
        self.count = 0
    
    def __call__(self, outputs, target, loss_outputs):
        self.count += 1
        self.val += 0.1
    
    def name(self):
        return self.metric_name
    
    def value(self):
        return self.val

metrics = [DummyMetric("accuracy"), DummyMetric("precision")]

cuda = False
log_interval = 1

ARGS = {
    "train_loader": train_loader,
    "model": model,
    "loss_fn": loss_fn,
    "optimizer": optimizer,
    "cuda": cuda,
    "log_interval": log_interval,
    "metrics": metrics
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tuplize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AsuradaYuci/tripletreid-zhushi/lbtoolbox.py
code served (permissive licence) · get_code("ec3794294a86cc5a")
How it ran

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

import torch
import numpy as np

torch.manual_seed(0)

# The function `tuplize` takes three parameters:
# 1. `what` - can be None, a tuple, a list, or any other object
# 2. `lists` - boolean flag (default True)
# 3. `tuplize_none` - boolean flag (default False)

# Test various input types for `what`:
test_what_values = [
    None,                          # None case
    (1, 2, 3),                     # Already a tuple
    [4, 5, 6],                     # A list
    "single_string",               # A single object
    torch.tensor([1.0, 2.0]),     # A tensor
    42,                            # An integer
]

# We'll construct ARGS with representative test cases
# Using the first test case as the main one
ARGS = {
    "what": [1, 2, 3],             # A list to be tuplized
    "lists": True,                 # Treat lists as tuples
    "tuplize_none": False,         # Don't tuplize None
}
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 tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
valid_ext Ran
ran, violated the contract we drafted
tbmoon/facenet/mtcnn.py
code served (permissive licence) · get_code("bf2651694c0c427e")
How it ran

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

import torch

torch.manual_seed(0)

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

def example_function(x, y, z=10):
    """A simple function to partially wrap"""
    return x + y + z

def another_function(a, b, c=5):
    """Another function for testing"""
    return a * b + c

torch.manual_seed(0)

ARGS = {
    "func": example_function,
    "args": (5, 3),
    "kwargs": {"z": 20}
}
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 partial — a partial output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a partial 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
writeable_directory Ran
ran; our contract draft was wrong, not the code
AsuradaYuci/tripletreid-zhushi/common.py
code served (permissive licence) · get_code("ea0ec55f5f51c7e1")
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 str. 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 os
import tempfile

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Ensure the directory exists and is writable
os.chmod(temp_dir, 0o755)

ARGS = {
    'arg': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
writeable_directory Ran
ran; our contract draft was wrong, not the code
thomas-liao/diva_tracking_reid/common.py
code served (permissive licence) · get_code("1ce4139aa71c6a1d")
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 str. 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 os
import tempfile
from argparse import ArgumentTypeError

def writeable_directory(arg):
    """ To be used as a type for `ArgumentParser.add_argument`. """
    return check_directory(arg, os.W_OK, 'writeable')

def check_directory(arg, access=os.W_OK, access_str='writeable'):
    """ Check for directory-type argument validity.

    Checks whether the given `arg` commandline argument is either a readable
    existing directory, or a createable/writeable directory.

    Args:
        arg (string): The commandline argument to check.
        access (constant): What access rights to the directory are requested.
        access_str (string): Used for the error message.

    Returns:
        The string passed din `arg` if the checks succeed.

    Raises:
        ArgumentTypeError if the checks fail.
    """
    path_head = arg
    while path_head:
        if os.path.exists(path_head):
            if os.access(path_head, access):
                return arg
            else:
                raise ArgumentTypeError('The provided string `{0}` is not a valid {1} path since {2} is an existing folder without {1} access.'.format(arg, access_str, path_head))
        path_head, _ = os.path.split(path_head)
    raise ArgumentTypeError('The provided string `{}` is not a valid {} path.'.format(arg, access_str))

# Create a temporary writeable directory for testing
temp_dir = tempfile.mkdtemp()
test_path = os.path.join(temp_dir, 'output_dir')

ARGS = {
    'arg': test_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
create_dat Not yet run
unverified (harvested, no recorded run)
AsuradaYuci/tripletreid-zhushi/lbtoolbox.py
code served (permissive licence) · get_code("c081c93cd90e636b")
How it ran

no invocation recorded.

evaluate Not yet run
unverified (harvested, no recorded run)
tbmoon/facenet/eval_metrics.py
code served (permissive licence) · get_code("a6bdfe104037e7f5")
How it ran

no invocation recorded.

five_crops Not yet run
unverified (harvested, no recorded run)
AsuradaYuci/tripletreid-zhushi/embed.py
code served (permissive licence) · get_code("b1c214482b18d02c")
How it ran

no invocation recorded.

load_state Not yet run
unverified (harvested, no recorded run)
tbmoon/facenet/models.py
code served (permissive licence) · get_code("e07f80108977f267")
How it ran

no invocation recorded.

mean_average_precision Not yet run
unverified (harvested, no recorded run)
BarbaAlGhul/recommender-system-thesis/evaluate.py
code served (permissive licence) · get_code("a3a9be21cfa9c135")
How it ran

no invocation recorded.

normalized_mean Not yet run
unverified (harvested, no recorded run)
AsuradaYuci/tripletreid-zhushi/aggregators.py
code served (permissive licence) · get_code("ab2f98823f035603")
How it ran

no invocation recorded.

roc_auc Not yet run
unverified (harvested, no recorded run)
BarbaAlGhul/recommender-system-thesis/evaluate.py
code served (permissive licence) · get_code("0ec981d9205019e5")
How it ran

no invocation recorded.

Also present in other papers' code

Of 46 samples lifted from this paper's linked repositories, 46 carry a function identity and 0 do not. Of the 40 distinct functions with an identity, 11 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 6 later) and 29 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
calculate_accuracy 12 other papers
2 dated earlier, 10 later
1503.03832 (2015-03)
FaceNet: A Unified Embedding for Face Recognition and Clustering
1607.08221 (2016-07)
MS-Celeb-1M: A Dataset and Benchmark for Large-Scale Face Recognition
1705.02304 (2017-05)
Deep Speaker: an End-to-End Neural Speaker Embedding System
and 9 more not named here
wrapped_partial 8 other papers
1 dated earlier, 7 later
1701.06487 (2017-01)
Dirty Pixels: Towards End-to-End Image Processing and Perception
1710.06081 (2017-10)
Boosting Adversarial Attacks with Momentum
1808.00897 (2018-08)
BiSeNet: Bilateral Segmentation Network for Real-time Semantic Segmentation
and 5 more not named here
all_diffs 3 other papers
3 later
1811.06879 (2018-11)
The Perfect Match: 3D Point Cloud Matching with Smoothed Densities
2003.03164 (2020-03)
D3Feat: Joint Learning of Dense Detection and Description of 3D Local Features
2203.14493 (2022-03)
ARCS: Accurate Rotation and Correspondence Search
cdist 3 other papers
3 later
1811.06879 (2018-11)
The Perfect Match: 3D Point Cloud Matching with Smoothed Densities
2003.03164 (2020-03)
D3Feat: Joint Learning of Dense Detection and Description of 3D Local Features
2203.14493 (2022-03)
ARCS: Accurate Rotation and Correspondence Search
get_at_indices 3 other papers
3 later
1811.06879 (2018-11)
The Perfect Match: 3D Point Cloud Matching with Smoothed Densities
2003.03164 (2020-03)
D3Feat: Joint Learning of Dense Detection and Description of 3D Local Features
2203.14493 (2022-03)
ARCS: Accurate Rotation and Correspondence Search
pdist 2 other papers
1 dated earlier, 1 later
1301.3781 (2013-01)
Efficient Estimation of Word Representations in Vector Space
2002.10191 (2020-02)
Learning Attentive Pairwise Interaction for Fine-Grained Classification
calculate_roc 1 other paper
1 dated earlier
1503.03832 (2015-03)
FaceNet: A Unified Embedding for Face Recognition and Clustering
hardest_negative 1 other paper
1 dated earlier
1301.3781 (2013-01)
Efficient Estimation of Word Representations in Vector Space
random_hard_negative 1 other paper
1 dated earlier
1301.3781 (2013-01)
Efficient Estimation of Word Representations in Vector Space
test_epoch 1 other paper
1 dated earlier
1412.6622 (2014-12)
Deep metric learning using Triplet network
train_epoch 1 other paper
1 dated earlier
1412.6622 (2014-12)
Deep metric learning using Triplet network

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

More are linked than shown here.

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

Abstract

In the past few years, the field of computer vision has gone through a revolution fueled mainly by the advent of large datasets and the adoption of deep convolutional neural networks for end-to-end learning. The person re-identification subfield is no exception to this. Unfortunately, a prevailing belief in the community seems to be that the triplet loss is inferior to using surrogate losses (classification, verification) followed by a separate metric learning step. We show that, for models trained from scratch as well as pretrained ones, using a variant of the triplet loss to perform end-to-end deep metric learning outperforms most other published methods by a large margin.

For agents

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

get_harvested_code_for_paper("1703.07737")
get_code_for_paper("1703.07737")
have("1703.07737")

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

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

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

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

Connect an agent — have() is free.