SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1805.01978 · 2018

Unsupervised Feature Learning via Non-Parametric Instance-level Discrimination

Zhirong Wu, Stella Yu, Dahua Lin, Yuanjun Xiong, Berkeley Icsi

arXiv · PDF · Open in the Atlas

Code that ran

19 of 23 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (14 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 17 have no contract verdict; 2 failures of our instrument; 4 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/1805.01978.json · badge: /api/ran/1805.01978.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
ly9802/DynamicAccumulatedAttentionMap community
Papers with Code archive
4 ran · 0 no recorded run
BaladityaY/lemniscate_reproduce_bdd community
Papers with Code archive
2 ran · 2 no recorded run
sforsyth6/coco_lem community
Papers with Code archive
2 ran · 1 no recorded run
microsoft/metric-transfer.pytorch community
Papers with Code archive
2 ran · 1 no recorded run
szq0214/CMC_with_Image_Mixture community
Papers with Code archive
2 ran · 0 no recorded run
sforsyth6/cifar_lem community
Papers with Code archive
2 ran · 0 no recorded run
BaladityaY/lemniscate_vis community
Papers with Code archive
2 ran · 0 no recorded run
sforsyth6/lemniscate-original community
Papers with Code archive
2 ran · 0 no recorded run
mangye16/Unsupervised_Embedding_Learning community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
ActivationAndGradients Ran
ran on a synthesized input · constructed an object; no result was computed
ly9802/DynamicAccumulatedAttentionMap/utils/DAAM.py
code served (permissive licence) · get_code("8d07fbd55802678f")
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 an instance of its own class, ActivationAndGradients: the run constructed the object and did not call it, so no result was computed. 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

torch.manual_seed(0)

class AttentionModule(nn.Module):
    """Mock attention module that has the attributes used in change_activation"""
    def __init__(self, dim=4, num_heads=2):
        super().__init__()
        self.dim = dim
        self.num_heads = num_heads
        self.qkv = nn.Linear(dim, dim * 3)
        self.scale = (dim // num_heads) ** -0.5
        self.attn_drop = nn.Dropout(0.0)
        self.proj = nn.Linear(dim, dim)
    
    def forward(self, x):
        return self.proj(x)

class ProjectionModule(nn.Module):
    """Mock projection module for the second target layer"""
    def __init__(self, dim=4):
        super().__init__()
        self.proj = nn.Linear(dim, dim)
    
    def forward(self, x):
        return self.proj(x)

class SimpleModel(nn.Module):
    """Simple model containing attention and projection layers"""
    def __init__(self):
        super().__init__()
        self.attn = AttentionModule(dim=4, num_heads=2)
        self.proj = ProjectionModule(dim=4)
    
    def forward(self, x):
        x = self.attn(x)
        x = self.proj(x)
        return x

model = SimpleModel()

# Create target_layers: list of tuples containing (attention_module, projection_module)
attn_layer = model.attn
proj_layer = model.proj
target_layers = [(attn_layer, proj_layer)]

# block_layers - not used in __init__, so can be empty or a simple list
block_layers = []

# arch_name - just a string identifier
arch_name = "simple_vit"

ARGS = {
    "model": model,
    "target_layers": target_layers,
    "block_layers": block_layers,
    "arch_name": arch_name
}
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 ActivationAndGradients — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ActivationAndGradients 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
AliasMethod Ran
ran on a synthesized input · constructed an object; no result was computed
sforsyth6/coco_lem/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("f880630982d445cc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/coco_lem 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.

AliasMethod Ran
ran on a synthesized input · constructed an object; no result was computed
szq0214/CMC_with_Image_Mixture/NCE/NCEAverage.py
pointer only (licence: NONE) · get_code("7f8ed4a41b193cc7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, szq0214/CMC_with_Image_Mixture 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.

AliasMethod Ran
ran on a synthesized input
microsoft/metric-transfer.pytorch/lib/NCEAverage.py
code served (permissive licence) · get_code("cc7f025d23fca482")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 1, dtype family int, shape (5,) as a later run recorded it. 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, 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

class AliasMethod(object):
    """
    From: https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/
    """

    def __init__(self, probs):
        if probs.sum() > 1:
            probs.div_(probs.sum())
        K = len(probs)
        self.prob = torch.zeros(K)
        self.alias = torch.LongTensor([0] * K)
        smaller = []
        larger = []
        for kk, prob in enumerate(probs):
            self.prob[kk] = K * prob
            if self.prob[kk] < 1.0:
                smaller.append(kk)
            else:
                larger.append(kk)
        while len(smaller) > 0 and len(larger) > 0:
            small = smaller.pop()
            large = larger.pop()
            self.alias[small] = large
            self.prob[large] = self.prob[large] - 1.0 + self.prob[small]
            if self.prob[large] < 1.0:
                smaller.append(large)
            else:
                larger.append(large)
        for last_one in smaller + larger:
            self.prob[last_one] = 1

    def cuda(self):
        self.prob = self.prob.cuda()
        self.alias = self.alias.cuda()

    def draw(self, N):
        """
            Draw N samples from multinomial
        """
        K = self.alias.size(0)
        kk = torch.zeros(N, dtype=torch.long, device=self.prob.device).random_(0, K)
        prob = self.prob.index_select(0, kk)
        alias = self.alias.index_select(0, kk)
        b = torch.bernoulli(prob)
        oq = kk.mul(b.long())
        oj = alias.mul((1 - b).long())
        return oq + oj


INIT_ARGS = {
    'probs': torch.tensor([0.1, 0.2, 0.3, 0.4])
}

ARGS = {
    'N': 5
}

METHOD = 'draw'

if __name__ == '__main__':
    alias_method = AliasMethod(**INIT_ARGS)
    result = alias_method.draw(**ARGS)
    print(result)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family int, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
AliasMethod Ran
ran on a synthesized input
BaladityaY/lemniscate_reproduce_bdd/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("3890fd0692fdd19f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, BaladityaY/lemniscate_reproduce_bdd 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.

BatchCriterion Ran
ran on a synthesized input · constructed an object; no result was computed
mangye16/Unsupervised_Embedding_Learning/BatchAverage.py
pointer only (licence: NONE) · get_code("40d8de9bf103b33f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, mangye16/Unsupervised_Embedding_Learning 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.

ClassifierOutputTarget Ran
ran on a synthesized input · constructed an object; no result was computed
ly9802/DynamicAccumulatedAttentionMap/utils/DAAM.py
code served (permissive licence) · get_code("d466f84425f5b627")
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 an instance of its own class, ClassifierOutputTarget: the run constructed the object and did not call it, so no result was computed. 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

torch.manual_seed(0)

# ClassifierOutputTarget expects:
# - category: an integer index for selecting from model output
# The __call__ method expects model_output to be a tensor with either:
#   - 1D shape (single sample): returns model_output[category]
#   - 2D shape (batch): returns model_output[:, category]

# We'll test with a batch dimension case
category = 2  # Select the 3rd category (0-indexed)

ARGS = {
    "category": category
}
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 ClassifierOutputTarget — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ClassifierOutputTarget 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
DynamicAccumulatedAttentionMap Ran
ran on a synthesized input · constructed an object; no result was computed
ly9802/DynamicAccumulatedAttentionMap/utils/DAAM.py
code served (permissive licence) · get_code("521ff999fdd4b08e")
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 an instance of its own class, DynamicAccumulatedAttentionMap: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
import math

torch.manual_seed(0)

class AttentionBlock(nn.Module):
    def __init__(self, dim=4, num_heads=2):
        super().__init__()
        self.num_heads = num_heads
        self.scale = (dim // num_heads) ** -0.5
        self.qkv = nn.Linear(dim, dim * 3)
        self.attn_drop = nn.Dropout(0.0)
        
    def forward(self, x):
        B, N, C = x.shape
        qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
        q, k, v = qkv[0], qkv[1], qkv[2]
        attn = q @ k.transpose(-2, -1) * self.scale
        attn = attn.softmax(dim=-1)
        attn = self.attn_drop(attn)
        x_out = (attn @ v).transpose(1, 2).reshape(B, N, C)
        return x_out

class ProjectionLayer(nn.Module):
    def __init__(self, dim=4):
        super().__init__()
        self.proj = nn.Linear(dim, dim)
        
    def forward(self, x):
        return self.proj(x)

class SimpleVisionTransformer(nn.Module):
    def __init__(self, num_classes=10, dim=4, num_heads=2):
        super().__init__()
        self.patch_embed = nn.Linear(3, dim)
        self.attn_block1 = AttentionBlock(dim=dim, num_heads=num_heads)
        self.proj1 = ProjectionLayer(dim=dim)
        self.attn_block2 = AttentionBlock(dim=dim, num_heads=num_heads)
        self.proj2 = ProjectionLayer(dim=dim)
        self.head = nn.Linear(dim, num_classes)
        
    def forward(self, x):
        # x shape: (B, C, H, W) -> reshape to (B, N, dim)
        B, C, H, W = x.shape
        x = x.permute(0, 2, 3, 1).reshape(B, H * W, C)
        x = self.patch_embed(x)
        x = self.attn_block1(x)
        x = self.proj1(x)
        x = self.attn_block2(x)
        x = self.proj2(x)
        x = x.mean(dim=1)  # global average pooling
        x = self.head(x)
        return x

model = SimpleVisionTransformer(num_classes=10, dim=4, num_heads=2)
model.eval()

target_layers = [
    (model.attn_block1, model.proj1),
    (model.attn_block2, model.proj2),
]

block_layers = None

input_tensor = torch.randn(2, 3, 4, 4)

ARGS = {
    'model': model,
    'target_layers': target_layers,
    'block_layers': block_layers,
    'use_cuda': False,
    'reshape_transform': None,
    'arch_name': 'vit',
    'norm': True,
    'gpu_id': 0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DynamicAccumulatedAttentionMap — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DynamicAccumulatedAttentionMap 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
MemoryInsDis Ran
ran on a synthesized input · constructed an object; no result was computed
szq0214/CMC_with_Image_Mixture/NCE/NCEAverage.py
pointer only (licence: NONE) · get_code("28d82e0982d698f7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, szq0214/CMC_with_Image_Mixture 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.

NCEAverage Ran
ran on a synthesized input · constructed an object; no result was computed
sforsyth6/coco_lem/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("e9b6afbeea8c2280")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/coco_lem 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.

NCEAverage Ran
ran on a synthesized input · constructed an object; no result was computed
sforsyth6/cifar_lem/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("732448859bf05210")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/cifar_lem 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.

NCEAverage Ran
ran on a synthesized input · constructed an object; no result was computed
BaladityaY/lemniscate_vis/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("b1f0c5d369793e61")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, BaladityaY/lemniscate_vis 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.

NCEAverage Ran
ran on a synthesized input · constructed an object; no result was computed
sforsyth6/lemniscate-original/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("77cfd89674b8f37b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/lemniscate-original 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.

NCEAverage Ran
ran on a synthesized input
microsoft/metric-transfer.pytorch/lib/NCEAverage.py
code served (permissive licence) · get_code("8b28108d8cd9cedf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float; no output shape is stated. 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 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
from torch import nn
import math

class AliasMethod(object):
    """
    From: https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/
    """

    def __init__(self, probs):
        if probs.sum() > 1:
            probs.div_(probs.sum())
        K = len(probs)
        self.prob = torch.zeros(K)
        self.alias = torch.LongTensor([0] * K)
        smaller = []
        larger = []
        for kk, prob in enumerate(probs):
            self.prob[kk] = K * prob
            if self.prob[kk] < 1.0:
                smaller.append(kk)
            else:
                larger.append(kk)
        while len(smaller) > 0 and len(larger) > 0:
            small = smaller.pop()
            large = larger.pop()
            self.alias[small] = large
            self.prob[large] = self.prob[large] - 1.0 + self.prob[small]
            if self.prob[large] < 1.0:
                smaller.append(large)
            else:
                larger.append(large)
        for last_one in smaller + larger:
            self.prob[last_one] = 1

    def cuda(self):
        self.prob = self.prob.cuda()
        self.alias = self.alias.cuda()

    def draw(self, N):
        """
            Draw N samples from multinomial
        """
        K = self.alias.size(0)
        kk = torch.zeros(N, dtype=torch.long, device=self.prob.device).random_(0, K)
        prob = self.prob.index_select(0, kk)
        alias = self.alias.index_select(0, kk)
        b = torch.bernoulli(prob)
        oq = kk.mul(b.long())
        oj = alias.mul((1 - b).long())
        return oq + oj

from torch.autograd import Function

class NCEFunction(Function):

    @staticmethod
    def forward(self, x, y, memory, idx, params):
        K = int(params[0].item())
        T = params[1].item()
        Z = params[2].item()
        batchSize = x.size(0)
        outputSize = memory.size(0)
        inputSize = memory.size(1)
        idx.select(1, 0).copy_(y.data)
        weight = torch.index_select(memory, 0, idx.view(-1))
        weight.resize_(batchSize, K + 1, inputSize)
        out = torch.bmm(weight, x.data.resize_(batchSize, inputSize, 1))
        out.div_(T).exp_()
        x.data.resize_(batchSize, inputSize)
        if Z < 0:
            params[2] = out.mean() * outputSize
            Z = params[2].item()
            print('normalization constant Z is set to {:.1f}'.format(Z))
        out.div_(Z).resize_(batchSize, K + 1)
        self.save_for_backward(x, memory, y, weight, out, params)
        return out

    @staticmethod
    def backward(self, gradOutput):
        x, memory, y, weight, out, params = self.saved_tensors
        K = int(params[0].item())
        T = params[1].item()
        momentum = params[3].item()
        batchSize = gradOutput.size(0)
        gradOutput.data.mul_(out.data)
        gradOutput.data.div_(T)
        gradOutput.data.resize_(batchSize, 1, K + 1)
        gradInput = torch.bmm(gradOutput.data, weight)
        gradInput.resize_as_(x)
        weight_pos = weight.select(1, 0).resize_as_(x)
        weight_pos.mul_(momentum)
        weight_pos.add_(torch.mul(x.data, 1 - momentum))
        w_norm = weight_pos.pow(2).sum(1, keepdim=True).pow(0.5)
        updated_weight = weight_pos.div(w_norm)
        memory.index_copy_(0, y, updated_weight)
        return (gradInput, None, None, None, None)

class NCEAverage(nn.Module):

    def __init__(self, inputSize, outputSize, K, T=0.07, momentum=0.5):
        super(NCEAverage, self).__init__()
        self.nLem = outputSize
        self.unigrams = torch.ones(self.nLem)
        self.multinomial = AliasMethod(self.unigrams)
        self.multinomial.cuda()
        self.K = K
        self.register_buffer('params', torch.tensor([K, T, -1, momentum]))
        stdv = 1.0 / math.sqrt(inputSize / 3)
        self.register_buffer('memory', torch.rand(outputSize, inputSize).mul_(2 * stdv).add_(-stdv))

    def forward(self, x, y):
        batchSize = x.size(0)
        idx = self.multinomial.draw(batchSize * (self.K + 1)).view(batchSize, -1)
        out = NCEFunction.apply(x, y, self.memory, idx, self.params)
        return out


INIT_ARGS = {
    'inputSize': 4,
    'outputSize': 8,
    'K': 3,
    'T': 0.07,
    'momentum': 0.5
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': torch.LongTensor([0, 1])
}

if __name__ == '__main__':
    model = NCEAverage(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
NCEFunction Ran
ran on a synthesized input · constructed an object; no result was computed
sforsyth6/cifar_lem/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("af9f28352bd7e0df")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/cifar_lem 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.

NCEFunction Ran
ran on a synthesized input · constructed an object; no result was computed
BaladityaY/lemniscate_vis/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("711a1797529b0c79")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, BaladityaY/lemniscate_vis 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.

NCEFunction Ran
ran on a synthesized input · constructed an object; no result was computed
sforsyth6/lemniscate-original/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("c466639ec9235e60")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/lemniscate-original 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.

get_device Ran
ran; our contract draft was wrong, not the code
BaladityaY/lemniscate_reproduce_bdd/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("c4e32d2f2f124965")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, BaladityaY/lemniscate_reproduce_bdd 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.

reshape_transformation Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ly9802/DynamicAccumulatedAttentionMap/utils/DAAM.py
code served (permissive licence) · get_code("c8d2726addbf44f6")
How it ran

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

import torch
import math

torch.manual_seed(0)

# The function expects:
# - tensor: a 3D tensor with shape (bs, num_tokens, dim)
# - height: int (optional, gets overwritten by calculation)
# - width: int (optional, gets overwritten by calculation)
#
# The function:
# 1. Extracts bs, num_tokens, dim from tensor shape
# 2. Calculates height = int(math.sqrt(num_tokens - 1))
# 3. Slices tensor[:, 1:, :] which removes the first token
# 4. Reshapes to (bs, height, width, dim)
# 5. Transposes dimensions
#
# For a valid execution, we need num_tokens such that (num_tokens - 1) is a perfect square
# Let's use num_tokens = 226 (since sqrt(225) = 15)

bs = 2
num_tokens = 226
dim = 4

# Create tensor with shape (bs, num_tokens, dim)
tensor = torch.randn(bs, num_tokens, dim)

# height and width parameters (will be overridden in the function)
height = 14
width = 14

ARGS = {
    "tensor": tensor,
    "height": height,
    "width": width
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 4, 15, 15) — shape (2, 4, 15, 15) 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
NCEAverage Not yet run
unverified (harvested, no recorded run)
BaladityaY/lemniscate_reproduce_bdd/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("893c648e49a82a33")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, BaladityaY/lemniscate_reproduce_bdd 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. No invocation recorded.

NCEFunction Not yet run
unverified (harvested, no recorded run)
sforsyth6/coco_lem/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("6de2a2fbb24c09f4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, sforsyth6/coco_lem 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. No invocation recorded.

NCEFunction Not yet run
unverified (harvested, no recorded run)
microsoft/metric-transfer.pytorch/lib/NCEAverage.py
code served (permissive licence) · get_code("12c846f2b380b4c7")
How it ran

no invocation recorded.

NCEFunction Not yet run
unverified (harvested, no recorded run)
BaladityaY/lemniscate_reproduce_bdd/lib/NCEAverage.py
pointer only (licence: NONE) · get_code("ce0d9e87d7214f2a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, BaladityaY/lemniscate_reproduce_bdd 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. No invocation recorded.

Also present in other papers' code

Of 23 samples lifted from this paper's linked repositories, 23 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 18 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
AliasMethod
brick of this paper's assembly: helper, sampler
3 other papers
3 later · 2 only as an assembly brick
2009.14167 (2020-09)
Contrastive Distillation on Intermediate Representations for Language Model Compression
2103.16367 (2021-03)
Complementary Relation Contrastive Distillation
2203.03871 (2022-03)
Discriminability-Transferability Trade-Off: An Information-Theoretic Perspective

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

Neural net classifiers trained on data with annotated class labels can also capture apparent visual similarity among categories without being directed to do so. We study whether this observation can be extended beyond the conventional domain of supervised learning: Can we learn a good feature representation that captures apparent similarity among instances, instead of classes, by merely asking the feature to be discriminative of individual instances? We formulate this intuition as a non-parametric classification problem at the instance-level, and use noisecontrastive estimation to tackle the computational challenges imposed by the large number of instance classes. Our experimental results demonstrate that, under unsupervised learning settings, our method surpasses the stateof-the-art on ImageNet classification by a large margin. Our method is also remarkable for consistently improving test performance with more training data and better network architectures. By fine-tuning the learned feature, we further obtain competitive results for semi-supervised learning and object detection tasks. Our non-parametric model is highly compact: With 128 features per image, our method requires only 600MB storage for a million images, enabling fast nearest neighbour retrieval at the run time.

For agents

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

get_harvested_code_for_paper("1805.01978")
get_code_for_paper("1805.01978")
have("1805.01978")

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

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

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

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

Connect an agent — have() is free.