SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.00049 · 2020

In-Domain GAN Inversion for Real Image Editing

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 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/2004.00049.json · badge: /api/ran/2004.00049.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
genforce/idinvert_pytorch community (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
genforce/idinvert community (classifier label)
classifier basis not recorded on the link
2 ran · 2 no recorded run
FunctionStatusWhere it lives
build_generator Ran
ran; our contract draft was wrong, not the code
genforce/idinvert_pytorch/models/helper.py
code served (permissive licence) · get_code("01ad09c8b01d79ee")
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 StyleGANGenerator. 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 unittest.mock import MagicMock

torch.manual_seed(0)

# Mock MODEL_POOL - the function checks if model_name is in MODEL_POOL
MODEL_POOL = {
    'styleganinv_256': 'styleganinv',
    'styleganinv_512': 'styleganinv',
}

# Mock the StyleGANGenerator class
class StyleGANGenerator(nn.Module):
    def __init__(self, model_name, logger=None):
        super().__init__()
        self.model_name = model_name
        self.logger = logger
        # Add minimal attributes/methods that might be used
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

# Mock logger
class MockLogger:
    def info(self, msg):
        pass
    
    def debug(self, msg):
        pass
    
    def warning(self, msg):
        pass
    
    def error(self, msg):
        pass

# Inject mocks into the module namespace for the function
import sys
current_module = sys.modules[__name__]
current_module.MODEL_POOL = MODEL_POOL
current_module.StyleGANGenerator = StyleGANGenerator

# Define arguments
ARGS = {
    'model_name': 'styleganinv_256',
    'logger': MockLogger()
}
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 StyleGANGenerator — a StyleGANGenerator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a StyleGANGenerator 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
format_time Ran
ran; our contract draft was wrong, not the code
genforce/idinvert/dnnlib/util.py
pointer only (licence: MIT); the stored copy get_code serves, from ntuaislab/DRAG, is pointer only (licence: NOASSERTION) · get_code("053fc534bc6bb989")
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 ntuaislab/DRAG, and GitHub could not classify the licence of that repository (NOASSERTION). 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_temp_logger Ran
ran; our contract draft was wrong, not the code
genforce/idinvert_pytorch/models/base_module.py
code served (permissive licence) · get_code("ff0d399a0317c249")
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 Logger. 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 sys

# The function get_temp_logger takes a single parameter: logger_name
# which is a string that should not be empty.
# Looking at the function body:
# - It checks if logger_name is empty and raises ValueError if so
# - It uses logger_name as the argument to logging.getLogger()
# - No other parameters are needed

ARGS = {
    'logger_name': 'test_logger'
}
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 Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger 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
get_weight_path Ran
ran; our contract draft was wrong, not the code
genforce/idinvert_pytorch/models/model_settings.py
code served (permissive licence) · get_code("5eb9fdaa872d49a6")
How it ran

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

import os
import tempfile

# Create a temporary directory to simulate MODEL_DIR
temp_dir = tempfile.mkdtemp()
MODEL_DIR = os.path.join(temp_dir, 'pretrain')
os.makedirs(MODEL_DIR, exist_ok=True)

# Test cases for get_weight_path
ARGS = {
    'weight_name': 'model_weights'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
tuple_product Ran
ran, violated the contract we drafted
genforce/idinvert/dnnlib/util.py
code served (permissive licence) · get_code("efd5d4ab788539f4")
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 torch
import numpy as np
from typing import Tuple, Any

torch.manual_seed(0)

# The function tuple_product takes a tuple and multiplies all its elements together
# We need to create a tuple with elements that support multiplication

# Test with numbers (int, float)
ARGS = {
    "t": (2, 3, 4, 5)
}
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 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
ask_yes_no Not yet run
unverified (harvested, no recorded run)
genforce/idinvert/dnnlib/util.py
code served (permissive licence) · get_code("9d31d2c4cd16bb2d")
How it ran

no invocation recorded.

build_encoder Not yet run
unverified (harvested, no recorded run)
genforce/idinvert_pytorch/models/helper.py
code served (permissive licence) · get_code("6bc5a9d2ae904282")
How it ran

no invocation recorded.

execute_cmdline Not yet run
unverified (harvested, no recorded run)
genforce/idinvert/dataset_tool.py
pointer only (licence: MIT); the stored copy get_code serves, from Uemuet/-gan, is pointer only (licence: NOASSERTION) · get_code("31857d2f579c1600")
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 Uemuet/-gan, and GitHub could not classify the licence of that repository (NOASSERTION). 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 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 8 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 4 the same month, 7 later) and 0 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
format_time 73 other papers
1 the same month, 71 later, 1 undated
2004.11660 (2020-04)
Disentangled and Controllable Face Image Generation via 3D Imitative-Contrastive Learning
2108.00946 (2021-08)
StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators
2202.00273 (2022-02)
StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets
and 70 more not named here
ask_yes_no 69 other papers
1 the same month, 67 later, 1 undated
2004.11660 (2020-04)
Disentangled and Controllable Face Image Generation via 3D Imitative-Contrastive Learning
2108.00946 (2021-08)
StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators
2202.00273 (2022-02)
StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets
and 66 more not named here
tuple_product 8 other papers
1 the same month, 7 later
2004.11660 (2020-04)
Disentangled and Controllable Face Image Generation via 3D Imitative-Contrastive Learning
2310.11440 (2023-10)
EvalCrafter: Benchmarking and Evaluating Large Video Generation Models
2311.17101 (2023-11)
A High-Quality Robust Diffusion Framework for Corrupted Dataset
and 5 more not named here
get_temp_logger 3 other papers
2 dated earlier, 1 later
1812.04948 (2018-12)
A Style-Based Generator Architecture for Generative Adversarial Networks
1911.09267 (2019-11)
Semantic Hierarchy Emerges in Deep Generative Representations for Scene Synthesis
2104.08910 (2021-04)
Towards Open-World Text-Guided Face Image Generation and Manipulation
execute_cmdline 2 other papers
1 dated earlier, 1 the same month
1912.04958 (2019-12)
Analyzing and Improving the Image Quality of StyleGAN
2004.11660 (2020-04)
Disentangled and Controllable Face Image Generation via 3D Imitative-Contrastive Learning
build_encoder 1 other paper
1 later
2104.08910 (2021-04)
Towards Open-World Text-Guided Face Image Generation and Manipulation
build_generator 1 other paper
1 later
2104.08910 (2021-04)
Towards Open-World Text-Guided Face Image Generation and Manipulation
get_weight_path 1 other paper
1 later
2104.08910 (2021-04)
Towards Open-World Text-Guided Face Image Generation and Manipulation

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

Recent work has shown that a variety of semantics emerge in the latent space of Generative Adversarial Networks (GANs) when being trained to synthesize images. However, it is difficult to use these learned semantics for real image editing. A common practice of feeding a real image to a trained GAN generator is to invert it back to a latent code. However, existing inversion methods typically focus on reconstructing the target image by pixel values yet fail to land the inverted code in the semantic domain of the original latent space. As a result, the reconstructed image cannot well support semantic editing through varying the inverted code. To solve this problem, we propose an in-domain GAN inversion approach, which not only faithfully reconstructs the input image but also ensures the inverted code to be semantically meaningful for editing. We first learn a novel domain-guided encoder to project a given image to the native latent space of GANs. We then propose domain-regularized optimization by involving the encoder as a regularizer to fine-tune the code produced by the encoder and better recover the target image. Extensive experiments suggest that our inversion method achieves satisfying real image reconstruction and more importantly facilitates various image editing tasks, significantly outperforming start-of-the-arts.

For agents

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

get_harvested_code_for_paper("2004.00049")
get_code_for_paper("2004.00049")
have("2004.00049")

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

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

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

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

Connect an agent — have() is free.