SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.16173 · CVPR · 2021

Contrastive Embedding for Generalized Zero-Shot Learning

Shuo Chen, Jian Yang, Zongyan Han, Zhenyong Fu

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 2 failures of our instrument; 1 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/2103.16173.json · badge: /api/ran/2103.16173.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
Hanzy1996/CE-GZSL canonical (classifier label)
classifier basis: census
1 ran · 0 no recorded run
Huihui-z/CE-GZSL community (classifier label)
classifier basis: plan_row
2 ran · 0 no recorded run
CristianoPatricio/zsl-methods community
Papers with Code archive
1 ran · 1 no recorded run
FunctionStatusWhere it lives
LINEAR_LOGSOFTMAX Ran
ran on a synthesized input · constructed an object; no result was computed
CristianoPatricio/zsl-methods/CE-GSZL/CE-GZSL-adapted/classifier_embed_contras.py
pointer only (licence: NONE) · get_code("741735399d42d232")
How it ran

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

create_logger Ran
ran; our contract draft was wrong, not the code
Hanzy1996/CE-GZSL/logger.py
code served (permissive licence) · get_code("6435a81f35d7cc50")
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 RootLogger. 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 logging
import time
from datetime import timedelta

class LogFormatter:

    def __init__(self):
        self.start_time = time.time()

    def format(self, record):
        elapsed_seconds = round(record.created - self.start_time)
        prefix = '%s - %s - %s' % (record.levelname, time.strftime('%x %X'), timedelta(seconds=elapsed_seconds))
        message = record.getMessage()
        message = message.replace('\n', '\n' + ' ' * (len(prefix) + 3))
        return '%s - %s' % (prefix, message)

def create_logger(filepath):
    """
    Create a logger.
    """
    log_formatter = LogFormatter()
    if filepath is not None:
        file_handler = logging.FileHandler(filepath, 'a')
        file_handler.setLevel(logging.DEBUG)
        file_handler.setFormatter(log_formatter)
    console_handler = logging.StreamHandler()
    console_handler.setLevel(logging.INFO)
    console_handler.setFormatter(log_formatter)
    logger = logging.getLogger()
    logger.handlers = []
    logger.setLevel(logging.DEBUG)
    logger.propagate = False
    if filepath is not None:
        logger.addHandler(file_handler)
    logger.addHandler(console_handler)

    def reset_time():
        log_formatter.start_time = time.time()
    logger.reset_time = reset_time
    return logger


ARGS = {
    "filepath": None
}
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 RootLogger — a RootLogger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RootLogger 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
map_label Ran
ran, violated the contract we drafted
Huihui-z/CE-GZSL/util.py
pointer only (licence: MIT); the stored copy get_code serves, from lijin118/LisGAN, is pointer only (licence: NONE) · get_code("7ac965f971d0020b")
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 lijin118/LisGAN, 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.

reparameter Ran
ran; our contract draft was wrong, not the code
Huihui-z/CE-GZSL/model.py
code served (permissive licence) · get_code("81abc9d73e3da3e6")
How it ran

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

import torch

torch.manual_seed(0)

# Create small tensors for mu and sigma
mu = torch.randn(2, 4)
sigma = torch.randn(2, 4)

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

The body of this sample is withheld: GitHub detected no licence in this paper's repository, CristianoPatricio/zsl-methods 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 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 later) and 2 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
map_label
brick of this paper's assembly: helper
8 other papers
4 dated earlier, 4 later · 1 only as an assembly brick
1812.01784 (2018-12)
Generalized Zero- and Few-Shot Learning via Aligned Variational Autoencoders
1904.04092 (2019-04)
Leveraging the Invariant Side of Generative Zero-Shot Learning
1904.08703 (2019-04)
Out-of-Distribution Detection for Generalized Zero-Shot Action Recognition
and 5 more not named here
create_logger 1 other paper
1 dated earlier
2004.11727 (2020-04)
Coach: A Coarse-to-Fine Approach for Cross-domain Slot Filling
reparameter 1 other paper
1 later
2107.13807 (2021-07)
FREE: Feature Refinement for Generalized Zero-Shot Learning

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

Generalized zero-shot learning (GZSL) aims to recognize objects from both seen and unseen classes, when only the labeled examples from seen classes are provided. Recent feature generation methods learn a generative model that can synthesize the missing visual features of unseen classes to mitigate the data-imbalance problem in GZSL. However, the original visual feature space is suboptimal for GZSL classification since it lacks discriminative information. To tackle this issue, we propose to integrate the generation model with the embedding model, yielding a hybrid GZSL framework. The hybrid GZSL approach maps both the real and the synthetic samples produced by the generation model into an embedding space, where we perform the final GZSL classification. Specifically, we propose a contrastive embedding (CE) for our hybrid GZSL framework. The proposed contrastive embedding can leverage not only the class-wise supervision but also the instance-wise supervision, where the latter is usually neglected by existing GZSL researches. We evaluate our proposed hybrid GZSL framework with contrastive embedding, named CE-GZSL, on five benchmark datasets. The results show that our CE-GZSL method can outperform the state-of-the-arts by a significant margin on three datasets. Our codes are available on https://github.com/Hanzy1996/CE-GZSL.

For agents

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

get_harvested_code_for_paper("2103.16173")
get_code_for_paper("2103.16173")
have("2103.16173")

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

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

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

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

Connect an agent — have() is free.