SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.00487 · CVPR · 2021

Linear Semantics in Generative Adversarial Networks

Changxi Zheng, Jianjin Xu

arXiv · PDF · Open in the Atlas

Code that ran

12 of 15 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 3 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/2104.00487.json · badge: /api/ran/2104.00487.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
AtlantixJJ/LinearGAN canonical (classifier label)
classifier basis: census
12 ran · 3 no recorded run
FunctionStatusWhere it lives
aggregate_iou Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/evaluate.py
code served (permissive licence) · get_code("bc4b2e8dd74b03fe")
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

torch.manual_seed(0)

# The function expects res to be a list of tuples where each tuple has at least 2 elements
# res[i][1] should be a tensor that can be stacked
# After stacking, we get a tensor of shape (num_results, num_classes)

# Create sample results: list of tuples where each tuple contains
# (some_data, iou_tensor)
# iou_tensor should have shape (num_classes,) for each result
num_results = 2
num_classes = 4

res = [
    (None, torch.tensor([0.5, 0.7, -0.05, 0.6])),
    (None, torch.tensor([0.8, -0.05, 0.4, 0.9])),
]

ARGS = {
    "res": res
}
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
formal_name Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/figure/layer_plot.py
code served (permissive licence) · get_code("5dd080ab390953df")
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 torch

torch.manual_seed(0)

# The function formal_name takes a single parameter 'name'
# It can be either a string or a list of strings
# The function performs string replacements on the name(s)

ARGS = {
    'name': 'stylegan_bedroom_celebahq_ffhq_pggan_church_test_'
}
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 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
gaussian_func Ran
ran, violated the contract we drafted
AtlantixJJ/LinearGAN/lib/op.py
code served (permissive licence) · get_code("fd34493454efc92f")
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
import math

def gaussian_func(x, mean, std):
    coef = 1 / math.sqrt(2 * math.pi) / std
    vals = np.exp(-(x - mean) ** 2 / 2 / std / std)
    return coef * vals

# Setup code
x = np.array([1.0, 2.0, 3.0, 4.0])
mean = 2.5
std = 1.0

ARGS = {
    "x": x,
    "mean": mean,
    "std": std
}
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
get_label_color Ran
ran, honoured the contract we drafted
AtlantixJJ/LinearGAN/lib/visualizer.py
code served (permissive licence) · get_code("18a135c1c6e8a12e")
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 int, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# The function signature appears to be incomplete in the provided code,
# but based on the context (high_contrast color palette), this is likely
# a function that maps label indices to colors from the palette.
# We'll construct reasonable arguments for a typical label-to-color function.

def get_label_color(label_idx):
    """Dummy function signature - the actual function appears truncated"""
    pass

# Since the function code is truncated, we'll make reasonable assumptions
# about what it does: takes a label index and returns a color from high_contrast

ARGS = {
    'label_idx': 5  # A valid index into the high_contrast palette (0-255)
}
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 int, shape (3,) — shape (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
int2onehot Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AtlantixJJ/LinearGAN/lib/op.py
code served (permissive licence) · get_code("6d654ffc5a2f11c6")
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, 3, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# x should be a 4D tensor with shape (batch_size, channels, height, width)
# The function expects x.shape[0] (batch), x.shape[2] (height), x.shape[3] (width)
# and uses scatter_ along dimension 1 with x as indices
# So x should contain integer indices in range [0, n)
x = torch.randint(0, 4, (2, 1, 3, 5))  # batch=2, channels=1, height=3, width=5

# n is the number of classes for one-hot encoding
n = 4

ARGS = {
    "x": x,
    "n": n
}
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, 3, 5) — shape (2, 4, 3, 5) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
lerp Ran
ran, honoured the contract we drafted
AtlantixJJ/LinearGAN/lib/op.py
code served (permissive licence) · get_code("51c0c1703f9f7417")
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 torch
import numpy as np

torch.manual_seed(0)

# lerp is a linear interpolation function that maps input range [a, b] to output range [x, y]
# at position i in the input range

a = 0.0
b = 10.0
x = 100.0
y = 200.0
i = 5.0

ARGS = {
    "a": a,
    "b": b,
    "x": x,
    "y": y,
    "i": i,
}
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 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
mask_cross_entropy_loss Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/lib/loss.py
code served (permissive licence) · get_code("7c24cc243ee9ccfb")
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 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
import torch.nn.functional as F

torch.manual_seed(0)

# mask: binary mask tensor, element-wise multiplied with cross entropy
# x: logits tensor, input to cross_entropy (batch_size, num_classes)
# y: target class indices tensor (batch_size,)

batch_size = 2
num_classes = 4

mask = torch.tensor([1.0, 0.5], dtype=torch.float32)
x = torch.randn(batch_size, num_classes)
y = torch.tensor([0, 2], dtype=torch.long)

ARGS = {
    "mask": mask,
    "x": x,
    "y": y,
}
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 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
mask_focal_loss Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/lib/loss.py
code served (permissive licence) · get_code("b4015457d599aa2b")
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 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
import torch.nn as nn
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for testing
batch_size = 2
num_classes = 4

# x: logits tensor for cross_entropy, shape (batch, num_classes)
x = torch.randn(batch_size, num_classes)

# y: target class indices, shape (batch,)
y = torch.randint(0, num_classes, (batch_size,))

# mask: binary mask tensor, shape (batch,)
mask = torch.tensor([1.0, 1.0])

ARGS = {
    'mask': mask,
    'x': x,
    'y': y
}
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 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
read_ade20k_labels Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/lib/misc.py
code served (permissive licence) · get_code("eee4b2def7c9d062")
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 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 tempfile
import os

# Create a temporary CSV file with ADE20K label format
temp_dir = tempfile.mkdtemp()
fpath = os.path.join(temp_dir, 'ade20k_labels.csv')

# Write a sample ADE20K labels CSV file
# Format: index,R,G,B,object_name;additional_info
with open(fpath, 'w') as f:
    f.write("index,R,G,B,object_name\n")
    f.write("0,0,0,0,void;background\n")
    f.write("1,128,64,128,wall;exterior\n")
    f.write("2,244,35,232,building;structure\n")
    f.write("3,70,70,70,sky;outdoor\n")
    f.write("4,102,102,156,tree;plant\n")

ARGS = {
    'fpath': fpath
}
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 list, ndim 1, dtype family float — 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
read_results Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/evaluate.py
code served (permissive licence) · get_code("a4df817ebb088365")
How it ran

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

import numpy as np
import tempfile
import os

# Create a temporary file with test results
temp_dir = tempfile.mkdtemp()
res_path = os.path.join(temp_dir, "results.txt")

# Write test data to the file
with open(res_path, 'w') as f:
    mIoU_value = 0.75
    c_iou_values = [0.8, 0.7, 0.65, 0.85]
    f.write(f"{mIoU_value}\n")
    f.write(" ".join(map(str, c_iou_values)))

ARGS = {
    "res_path": res_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_selected_labels Ran
ran; our contract draft was wrong, not the code
AtlantixJJ/LinearGAN/lib/misc.py
code served (permissive licence) · get_code("1a392f9ca44359d5")
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 dict. 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 tempfile
import os

# Create a temporary CSV file with test data
temp_dir = tempfile.mkdtemp()
fpath = os.path.join(temp_dir, 'selected_labels.csv')

with open(fpath, 'w') as f:
    f.write('model_a,category1,category2,category3\n')
    f.write('model_b,categoryX,categoryY\n')
    f.write('model_c,cat_alpha\n')

ARGS = {
    'fpath': fpath
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
set_cuda_devices Ran
ran, honoured the contract we drafted
AtlantixJJ/LinearGAN/lib/misc.py
code served (permissive licence) · get_code("0214a8f261e7bb84")
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 int, 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 os

ARGS = {
    'device_ids': '0,1',
    'use_cuda': True,
}
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 int, 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
G_from_SE Not yet run
unverified (harvested, no recorded run)
AtlantixJJ/LinearGAN/evaluate.py
code served (permissive licence) · get_code("2d79fedbd2e3646f")
How it ran

no invocation recorded.

get_classes Not yet run
unverified (harvested, no recorded run)
AtlantixJJ/LinearGAN/figure/layer_plot.py
code served (permissive licence) · get_code("fb61c14dfdff06f2")
How it ran

no invocation recorded.

get_text Not yet run
unverified (harvested, no recorded run)
AtlantixJJ/LinearGAN/figure/layer_plot.py
code served (permissive licence) · get_code("a3f50a610e7c3cd8")
How it ran

no invocation recorded.

Also present in other papers' code

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

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

Generative Adversarial Networks (GANs) are able to generate high-quality images, but it remains difficult to explicitly specify the semantics of synthesized images. In this work, we aim to better understand the semantic representation of GANs, and thereby enable semantic control in GAN's generation process. Interestingly, we find that a well-trained GAN encodes image semantics in its internal feature maps in a surprisingly simple way: a linear transformation of feature maps suffices to extract the generated image semantics. To verify this simplicity, we conduct extensive experiments on various GANs and datasets; and thanks to this simplicity, we are able to learn a semantic segmentation model for a trained GAN from a small number (e.g., 8) of labeled images. Last but not least, leveraging our finding, we propose two few-shot image editing approaches, namely Semantic-Conditional Sampling and Semantic Image Editing. Given a trained GAN and as few as eight semantic annotations, the user is able to generate diverse images subject to a userprovided semantic layout, and control the synthesized image semantics. We have made the code publicly available 1 .

For agents

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

get_harvested_code_for_paper("2104.00487")
get_code_for_paper("2104.00487")
have("2104.00487")

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

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

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

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

Connect an agent — have() is free.