SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.14348 · CVPR · 2023

Zero-Shot Everything Sketch-Based Image Retrieval, and in Explainable Style

Timothy Hospedales, Yi-Zhe Song, Da Li, Yonggang Qi, Fengyin Lin, Mingkang Li

arXiv · PDF · Open in the Atlas

Code that ran

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

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2303.14348.json · badge: /api/ran/2303.14348.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
buptLinfy/ZSE-SBIR community
Papers with Code archive
12 ran · 4 no recorded run
FunctionStatusWhere it lives
AddAndNorm Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("afe81aa89974190e")
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, AddAndNorm: 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)

ARGS = {
    'size': 4,
    'dropout': 0.1
}
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 AddAndNorm — 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 AddAndNorm 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
Encoder Ran
ran on a synthesized input
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("88b2eaf4a0201422")
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 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 torch
import torch.nn as nn
from einops import rearrange, repeat
import math

class MultiHeadDotProductAttention(nn.Module):

    def __init__(self, dim, heads=8, dropout=0.0):
        super().__init__()
        self.heads = heads
        self.scale = (dim / heads) ** (-0.5)
        self.to_qkv = nn.Linear(dim, dim * 3)
        self.to_out = nn.Sequential(nn.Linear(dim, dim), nn.Dropout(dropout))

    def forward(self, x, keep_rate, mask=None):
        b, n, c, h = (*x.shape, self.heads)
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), qkv)
        dots = torch.einsum('bhid,bhjd->bhij', q, k) * self.scale
        attn = dots.softmax(dim=-1)
        out = torch.einsum('bhij,bhjd->bhid', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        out = self.to_out(out)
        left_tokens = n - 1
        if keep_rate < 1:
            left_tokens = math.ceil(keep_rate * left_tokens)
            cls_attn = attn[:, :, 0, 1:]
            cls_attn = cls_attn.mean(dim=1)
            _, idx = torch.topk(cls_attn, left_tokens, dim=1, largest=True, sorted=True)
            idx, _ = torch.sort(idx)
            index = idx.unsqueeze(-1).expand(-1, -1, c)
            return (x, index, idx, cls_attn, left_tokens)
        return (out, None, None, None, left_tokens)

class FeedForward(nn.Module):

    def __init__(self, dim, hidden_dim, dropout=0.0):
        super().__init__()
        self.net = nn.Sequential(nn.Linear(dim, hidden_dim), nn.GELU(), nn.Dropout(dropout), nn.Linear(hidden_dim, dim), nn.Dropout(dropout))

    def forward(self, x):
        return self.net(x)

class Encoder1DBlock(nn.Module):

    def __init__(self, input_shape, heads, mlp_dim, dtype=torch.float32, dropout_rate=0.1, attention_dropout_rate=0.1, deterministic=True):
        super().__init__()
        self.mlp_dim = mlp_dim
        self.dtype = dtype
        self.dropout_rate = dropout_rate
        self.attention_dropout_rate = attention_dropout_rate
        self.deterministic = deterministic
        self.input_shape = input_shape
        self.layer_norm_input = nn.LayerNorm(input_shape)
        self.layer_norm_out = nn.LayerNorm(input_shape)
        self.attention = MultiHeadDotProductAttention(input_shape, heads=heads)
        self.mlp = FeedForward(input_shape, mlp_dim, dropout_rate)
        self.drop_out_attention = nn.Dropout(attention_dropout_rate)

    def forward(self, inputs, keep_rate):
        x = self.layer_norm_input(inputs)
        x, index, idx, cls_attn, left_tokens = self.attention(x, keep_rate)
        x = self.drop_out_attention(x)
        x = x + inputs
        if index is not None:
            non_cls = x[:, 1:]
            x_others = torch.gather(non_cls, dim=1, index=index)
            x = torch.cat([x[:, 0:1], x_others], dim=1)
        y = self.layer_norm_out(x)
        y = self.mlp(y)
        return (x + y, left_tokens, idx)

class Encoder(nn.Module):

    def __init__(self, input_shape, num_layers, heads, mlp_dim, inputs_positions=None, dropout_rate=0.1, train=False):
        super().__init__()
        self.num_layers = num_layers
        self.mlp_dim = mlp_dim
        self.inputs_positions = inputs_positions
        self.dropout_rate = dropout_rate
        self.train_flag = train
        self.encoder_norm = nn.LayerNorm(input_shape)
        self.layers = nn.ModuleList([])
        for _ in range(num_layers):
            self.layers.append(nn.ModuleList([Encoder1DBlock(input_shape, heads, mlp_dim)]))
        self.keep_rate = (1,) * 12

    def forward(self, img, mask=None):
        x = img
        left_tokens = []
        idxs = []
        for i, layer in enumerate(self.layers):
            x, left_token, idx = layer[0](x, self.keep_rate[i])
            left_tokens.append(left_token)
            idxs.append(idx)
        return (self.encoder_norm(x), left_tokens, idxs)


INIT_ARGS = {
    'input_shape': 4,
    'num_layers': 2,
    'heads': 2,
    'mlp_dim': 8,
    'inputs_positions': None,
    'dropout_rate': 0.1,
    'train': False
}

ARGS = {
    'img': torch.randn(2, 5, 4),
    'mask': None
}

if __name__ == '__main__':
    encoder = Encoder(**INIT_ARGS)
    output = encoder(**ARGS)
    print("Output shapes:")
    print(f"  Encoded: {output[0].shape}")
    print(f"  Left tokens: {output[1]}")
    print(f"  Indices: {output[2]}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Encoder1DBlock Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("bfdf0d1287b4d60a")
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, Encoder1DBlock: 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)

ARGS = {
    'input_shape': 4,
    'heads': 2,
    'mlp_dim': 8,
    'dtype': torch.float32,
    'dropout_rate': 0.1,
    'attention_dropout_rate': 0.1,
    'deterministic': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Encoder1DBlock — 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 Encoder1DBlock 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
EncoderLayer Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("6d34c0d54b4cd5cc")
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, EncoderLayer: 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
import copy

torch.manual_seed(0)

class LayerNorm(nn.Module):
    def __init__(self, features, eps=1e-06):
        super(LayerNorm, self).__init__()
        self.a = nn.Parameter(torch.ones(features))
        self.b = nn.Parameter(torch.zeros(features))
        self.eps = eps

    def forward(self, x):
        mean = x.mean(-1, keepdim=True)
        std = x.std(-1, keepdim=True)
        return self.a * (x - mean) / (std + self.eps) + self.b

class AddAndNorm(nn.Module):
    def __init__(self, size, dropout):
        super(AddAndNorm, self).__init__()
        self.norm = LayerNorm(size)
        self.dropout = nn.Dropout(dropout)

    def forward(self, x, y):
        return self.norm(x + self.dropout(y))

def clones(module, N):
    return nn.ModuleList([copy.deepcopy(module) for _ in range(N)])

class MockAttention(nn.Module):
    def __init__(self, size):
        super(MockAttention, self).__init__()
        self.size = size
    
    def forward(self, q, k, v, mask):
        batch_size = v.shape[0]
        seq_len = v.shape[1]
        return torch.randn(batch_size, seq_len, self.size)

class MockFeedForward(nn.Module):
    def __init__(self, size):
        super(MockFeedForward, self).__init__()
        self.size = size
    
    def forward(self, x):
        batch_size = x.shape[0]
        seq_len = x.shape[1]
        return torch.randn(batch_size, seq_len, self.size)

class EncoderLayer(nn.Module):
    def __init__(self, size, self_attn, feed_forward, dropout):
        super(EncoderLayer, self).__init__()
        self.self_attn = self_attn
        self.feed_forward = feed_forward
        self.sublayer = clones(AddAndNorm(size, dropout), 2)
        self.size = size

    def forward(self, q, k, v, mask):
        x = self.sublayer[0](v, self.self_attn(q, k, v, mask))
        x = self.sublayer[1](x, self.feed_forward(x))
        return x

size = 4
self_attn = MockAttention(size)
feed_forward = MockFeedForward(size)
dropout = 0.1

ARGS = {
    'size': size,
    'self_attn': self_attn,
    'feed_forward': feed_forward,
    'dropout': dropout
}
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 EncoderLayer — 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 EncoderLayer 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
LayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("9f9b1604d01394b4")
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, LayerNorm: 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)

# LayerNorm.__init__ takes: self, features, eps=1e-06
# LayerNorm.forward takes: self, x
# The forward method uses:
#   - x.mean(-1, keepdim=True)
#   - x.std(-1, keepdim=True)
#   - self.a (Parameter with shape matching features)
#   - self.b (Parameter with shape matching features)
#   - self.eps (scalar)
# So x should have shape (..., features)

features = 4
eps = 1e-06

# Create a small input tensor with shape (batch_size=2, seq_len=3, features=4)
x = torch.randn(2, 3, features)

ARGS = {
    "features": features,
    "eps": eps,
}
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 LayerNorm — 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 LayerNorm 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
MultiHeadDotProductAttention Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("31fe7ef87068a002")
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, MultiHeadDotProductAttention: 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
from einops import rearrange, repeat
import math

torch.manual_seed(0)

class MultiHeadDotProductAttention(nn.Module):

    def __init__(self, dim, heads=8, dropout=0.0):
        super().__init__()
        self.heads = heads
        self.scale = (dim / heads) ** (-0.5)
        self.to_qkv = nn.Linear(dim, dim * 3)
        self.to_out = nn.Sequential(nn.Linear(dim, dim), nn.Dropout(dropout))

    def forward(self, x, keep_rate, mask=None):
        b, n, c, h = (*x.shape, self.heads)
        qkv = self.to_qkv(x).chunk(3, dim=-1)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h=h), qkv)
        dots = torch.einsum('bhid,bhjd->bhij', q, k) * self.scale
        attn = dots.softmax(dim=-1)
        out = torch.einsum('bhij,bhjd->bhid', attn, v)
        out = rearrange(out, 'b h n d -> b n (h d)')
        out = self.to_out(out)
        left_tokens = n - 1
        if keep_rate < 1:
            left_tokens = math.ceil(keep_rate * left_tokens)
            cls_attn = attn[:, :, 0, 1:]
            cls_attn = cls_attn.mean(dim=1)
            _, idx = torch.topk(cls_attn, left_tokens, dim=1, largest=True, sorted=True)
            idx, _ = torch.sort(idx)
            index = idx.unsqueeze(-1).expand(-1, -1, c)
            return (x, index, idx, cls_attn, left_tokens)
        return (out, None, None, None, left_tokens)


# Create an instance of the model
model = MultiHeadDotProductAttention(dim=4, heads=2, dropout=0.1)

# Create input tensor: batch_size=2, sequence_length=5, embedding_dim=4
x = torch.randn(2, 5, 4)

# Set keep_rate to trigger the pruning logic
keep_rate = 0.6

# Optional mask parameter
mask = None

ARGS = {
    "dim": 4,
    "heads": 2,
    "dropout": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MultiHeadDotProductAttention — 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 MultiHeadDotProductAttention 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
MultiHeadedAttention Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("8b6a335cd0939a66")
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, MultiHeadedAttention: 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
import math
import copy
import torch.nn.functional as F

torch.manual_seed(0)

# Setup for MultiHeadedAttention.__init__ parameters
h = 8  # number of heads
d_model = 512  # model dimension (must be divisible by h)
dropout = 0.1  # dropout rate

ARGS = {
    'h': h,
    'd_model': d_model,
    'dropout': dropout
}
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 MultiHeadedAttention — 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 MultiHeadedAttention 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
PositionwiseFeedForward Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("2d97255bca4d10bc")
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, PositionwiseFeedForward: 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)

ARGS = {
    "d_model": 512,
    "d_ff": 2048,
    "dropout": 0.1,
}
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 PositionwiseFeedForward — 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 PositionwiseFeedForward 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
Relation_Network Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("f25396c41187c618")
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, Relation_Network: 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)

ARGS = {
    "anchor": 49,
    "dropout": 0.1,
}
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 Relation_Network — 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 Relation_Network 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
Scale_Embedding Ran
ran on a synthesized input · constructed an object; no result was computed
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("71497b370f236dea")
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, Scale_Embedding: 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)

# Scale_Embedding has no __init__ parameters other than self
# The forward method expects input x which should be a tensor
# Looking at the seq: it's a Conv2d chain expecting 3-channel input
# and applying convolutions with strides to progressively reduce spatial dims

# Create a small input tensor: batch_size=2, channels=3, height=4, width=4
x = torch.randn(2, 3, 4, 4)

ARGS = {
}
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 Scale_Embedding — 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 Scale_Embedding 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
attention Ran
ran; our contract draft was wrong, not the code
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("3eed1a7a6d48923a")
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 torch
import torch.nn as nn
import math

torch.manual_seed(0)

# Small tensors for attention: batch_size=2, seq_len=3, d_k=4
batch_size = 2
seq_len = 3
d_k = 4

query = torch.randn(batch_size, seq_len, d_k)
key = torch.randn(batch_size, seq_len, d_k)
value = torch.randn(batch_size, seq_len, d_k)

# Dropout layer
dropout = nn.Dropout(p=0.1)

# Mask: shape (batch_size, 1, seq_len, seq_len) with 1s where to attend, 0s where to mask
mask = torch.ones(batch_size, 1, seq_len, seq_len)

# Position encoding (optional, not used in function body but in signature)
pos = None

ARGS = {
    "query": query,
    "key": key,
    "value": value,
    "dropout": dropout,
    "mask": mask,
    "pos": pos,
}
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 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
cos_similar Ran
ran; our contract draft was wrong, not the code
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("a15a8757a1c2f059")
How it ran

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

import torch

torch.manual_seed(0)

# Create two tensors with distinct shapes for p and q
# p: (batch=2, dim=4)
# q: (batch=2, dim=4)
p = torch.randn(2, 4)
q = torch.randn(2, 4)

ARGS = {
    "p": p,
    "q": q,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 2) — shape (2, 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
Cross_Attention Not yet run
unverified (harvested, no recorded run)
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("f1822a4207bad8bd")
How it ran

no invocation recorded.

Model Not yet run
unverified (harvested, no recorded run)
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("36976ee282990c6e")
How it ran

no invocation recorded.

Self_Attention Not yet run
unverified (harvested, no recorded run)
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("83ad54e98125113e")
How it ran

no invocation recorded.

ViTPatch Not yet run
unverified (harvested, no recorded run)
buptLinfy/ZSE-SBIR/model/model.py
code served (permissive licence) · get_code("5077295b3497cdc4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 15 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
PositionwiseFeedForward
brick of this paper's assembly: helper
3 other papers
2 dated earlier, 1 later
1706.03762 (2017-06)
Attention Is All You Need
2010.16056 (2020-10)
Generating Radiology Reports via Memory-driven Transformer
2411.07527 (2024-11)
Prompt-enhanced Network for Hateful Meme Classification

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

Repositories linked to this paper

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

Abstract

This paper studies the problem of zero-short sketchbased image retrieval (ZS-SBIR), however with two significant differentiators to prior art (i) we tackle all variants (inter-category, intra-category, and cross datasets) of ZS-SBIR with just one network ("everything"), and (ii) we would really like to understand how this sketch-photo matching operates ("explainable"). Our key innovation lies with the realization that such a cross-modal matching problem could be reduced to comparisons of groups of key local patches -akin to the seasoned "bag-of-words" paradigm. Just with this change, we are able to achieve both of the aforementioned goals, with the added benefit of no longer requiring external semantic knowledge. Technically, ours is a transformer-based cross-modal network, with three novel components (i) a self-attention module with a learnable tokenizer to produce visual tokens that correspond to the most informative local regions, (ii) a cross-attention module to compute local correspondences between the visual tokens across two modalities, and finally (iii) a kernel-based relation network to assemble local putative matches and produce an overall similarity metric for a sketch-photo pair. Experiments show ours indeed delivers superior performances across all ZS-SBIR settings. The all important explainable goal is elegantly achieved by visualizing crossmodal token correspondences, and for the first time, via sketch to photo synthesis by universal replacement of all matched photo patches. Code and model are available at https://github.com/buptLinfy/ZSE-SBIR.

For agents

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

get_harvested_code_for_paper("2303.14348")
get_code_for_paper("2303.14348")
have("2303.14348")

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

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

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

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

Connect an agent — have() is free.