SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper · ICCV · 2021

LoFGAN: Fusing Local Representations for Few-shot Image Generation

Yang Gao, Lei Wang, Jing Huo, Wenbin Li, Zheng Gu

Open in the Atlas

Code that ran

11 of 11 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; 1 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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/Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper.json · badge: /api/ran/Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper.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
edward3862/LoFGAN-pytorch canonical (classifier label)
classifier basis: census
11 ran · 0 no recorded run
FunctionStatusWhere it lives
calc_content_loss Ran
ran on a synthesized input
edward3862/LoFGAN-pytorch/networks/loss.py
code served (permissive licence) · get_code("abe986b3424f895b")
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

torch.manual_seed(0)

# Create small 4D tensors (N, C, H, W)
# Using distinct dimensions: N=2, C=3, H=4, W=5
input_tensor = torch.randn(2, 3, 4, 5)
target_tensor = torch.randn(2, 3, 4, 5)

ARGS = {
    "input": input_tensor,
    "target": target_tensor,
    "norm": False
}
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
calc_mean_std Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
edward3862/LoFGAN-pytorch/networks/loss.py
code served (permissive licence) · get_code("38eaf8511dc7bc9c")
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) and returned tuple, ndim 5, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function expects a 4D tensor (N, C, H, W)
# N = batch size, C = channels, H = height, W = width
# Using distinct sizes: batch=2, channels=4, height=3, width=5
feat = torch.randn(2, 4, 3, 5)

ARGS = {
    "feat": feat,
    "eps": 1e-05
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple 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
default_filelist_reader Ran
ran on a synthesized input
edward3862/LoFGAN-pytorch/dataset.py
code served (permissive licence) · get_code("4ebc31837bc0f8df")
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 filelist file with some image paths
temp_dir = tempfile.mkdtemp()
filelist_path = os.path.join(temp_dir, "filelist.txt")

# Write some sample image paths to the file
with open(filelist_path, 'w') as f:
    f.write("path/to/image1.jpg\n")
    f.write("path/to/image2.png\n")
    f.write("path/to/image3.jpg\n")

ARGS = {
    "filelist": filelist_path
}
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
default_loader Ran
ran, honoured the contract we drafted
edward3862/LoFGAN-pytorch/dataset.py
pointer only (licence: MIT); the stored copy get_code serves, from xlgsyzp/cvpt, is pointer only (licence: NONE) · get_code("ac269a0e4b8d946e")
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 xlgsyzp/cvpt, 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.

get_config Ran
ran on a synthesized input
edward3862/LoFGAN-pytorch/utils.py
code served (permissive licence) · get_code("a4c23a9a55b9efd1")
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 yaml
import tempfile
import os

# Create a temporary YAML config file
config_dict = {
    'model': 'test_model',
    'learning_rate': 0.001,
    'batch_size': 32,
    'epochs': 10,
    'layers': [64, 128, 256]
}

# Write to a temporary file
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.yaml', delete=False)
yaml.dump(config_dict, temp_file)
temp_file.close()

ARGS = {
    'config': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
logsumexp_2d Ran
ran; our contract draft was wrong, not the code
edward3862/LoFGAN-pytorch/networks/blocks.py
code served (permissive licence) · get_code("7abfa32a2f1d7424")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 1) 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)

# The function expects a 3D or higher dimensional tensor
# It accesses tensor.size(0), tensor.size(1), and flattens the rest
# Let's create a 3D tensor with shape (batch=2, dim1=3, dim2=4)
tensor = torch.randn(2, 3, 4)

ARGS = {
    "tensor": tensor
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 3, dtype family float, shape (2, 3, 1) — shape (2, 3, 1) 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
make_result_folders Ran
ran on a synthesized input
edward3862/LoFGAN-pytorch/utils.py
code served (permissive licence) · get_code("264d10631d7c7833")
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, 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 os
import tempfile

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()
output_directory = os.path.join(temp_dir, 'test_output')

ARGS = {
    'output_directory': output_directory,
    'remove_first': 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 tuple, ndim 1, dtype family float — a tuple 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
mean_variance_norm Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
edward3862/LoFGAN-pytorch/networks/loss.py
code served (permissive licence) · get_code("19f218161cc28c54")
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) 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
import torch.nn as nn

torch.manual_seed(0)

# Create a small 4D tensor (N, C, H, W)
# N=2 (batch), C=4 (channels), H=3 (height), W=5 (width)
feat = torch.randn(2, 4, 3, 5)

ARGS = {
    "feat": feat
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
single_channel_loader Ran
ran on a synthesized input
edward3862/LoFGAN-pytorch/dataset.py
code served (permissive licence) · get_code("c7f73f864fd7ad15")
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 PngImageFile. 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
from PIL import Image
import os

# Create a temporary directory and a simple test image
temp_dir = tempfile.mkdtemp()
test_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple grayscale image (single channel)
img = Image.new('L', (4, 3), color=128)
img.save(test_image_path)

ARGS = {
    "path": test_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PngImageFile — a PngImageFile output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PngImageFile output the recorded ndim 2 and dtype family int 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
tensor_to_cv Ran
ran on a synthesized input
edward3862/LoFGAN-pytorch/main_vis_sim.py
code served (permissive licence) · get_code("4b184782d66c1129")
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 3, dtype family int, shape (4, 5, 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 torch
import cv2

torch.manual_seed(0)

# Create a tensor that matches what tensor_to_cv expects:
# - mul(255) and byte() suggest values in [0, 1]
# - squeeze() removes dimensions of size 1
# - transpose((1, 2, 0)) suggests input shape is (C, H, W)
# - cvtColor expects BGR format, so C should be 3
# Creating a tensor with shape (1, 3, 4, 5) where batch=1, channels=3, height=4, width=5
tensor = torch.rand(1, 3, 4, 5)

ARGS = {
    "tensor": tensor
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (4, 5, 3) — shape (4, 5, 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
weights_init Ran
ran; our contract draft was wrong, not the code
edward3862/LoFGAN-pytorch/trainer.py
pointer only (licence: MIT); the stored copy get_code serves, from bing-li-ai/AniGAN, is pointer only (licence: NOASSERTION) · get_code("bfde7f2a4f341baa")
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 bing-li-ai/AniGAN, 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.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 5 later) and 6 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
default_loader 27 other papers
12 dated earlier, 14 later, 1 same year, order not determinable
1710.03463 (2017-10)
Learning to Generalize: Meta-Learning for Domain Generalization
1803.08669 (2018-03)
Pyramid Stereo Matching Network
1810.11408 (2018-10)
Anytime Stereo Image Depth Estimation on Mobile Devices
and 24 more not named here
calc_mean_std 26 other papers
7 dated earlier, 16 later, 3 same year, order not determinable · 4 only as an assembly brick
1703.06868 (2017-03)
Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization
1812.02342 (2018-12)
Arbitrary Style Transfer with Style-Attentional Networks
1911.10033 (2019-11)
Domain Adaptation for Object Detection via Style Consistency
and 23 more not named here
logsumexp_2d 13 other papers
3 dated earlier, 7 later, 3 same year, order not determinable
1806.07366 (2018-06)
Neural Ordinary Differential Equations
1807.06521 (2018-07)
CBAM: Convolutional Block Attention Module
1810.12348 (2018-10)
Gather-Excite: Exploiting Feature Context in Convolutional Neural Networks
and 10 more not named here
weights_init 6 other papers
3 dated earlier, 1 later, 2 same year, order not determinable · 1 only as an assembly brick
1912.11164 (2019-12)
Unsupervised Scene Adaptation with Memory Regularization in vivo
2003.03773 (2020-03)
Rectifying Pseudo Label Learning via Uncertainty Estimation for Domain Adaptive Semantic Segmentation
2012.09071 (2020-12)
Joint Generative and Contrastive Learning for Unsupervised Person Re-identification
and 3 more not named here
mean_variance_norm 3 other papers
1 dated earlier, 1 later, 1 same year, order not determinable
1812.02342 (2018-12)
Arbitrary Style Transfer with Style-Attentional Networks
2108.03647 (2021-08)
AdaAttN: Revisit Attention Mechanism in Arbitrary Neural Style Transfer

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-24.

Repositories linked to this paper

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

Abstract

Given only a few available images for a novel unseen category, few-shot image generation aims to generate more data for this category. Previous works attempt to globally fuse these images by using adjustable weighted coefficients. However, there is a serious semantic misalignment between different images from a global perspective, making these works suffer from poor generation quality and diversity. To tackle this problem, we propose a novel Local-Fusion Generative Adversarial Network (LoFGAN) for fewshot image generation. Instead of using these available images as a whole, we first randomly divide them into a base image and several reference images. Next, LoFGAN matches local representations between the base and reference images based on semantic similarities, and replaces the local features with the closest related local features. In this way, LoFGAN can produce more realistic and diverse images at a more fine-grained level, and simultaneously enjoy the characteristic of semantic alignment. Furthermore, a local reconstruction loss is also proposed, which can provide better training stability and generation quality. We conduct extensive experiments on three datasets, which successfully demonstrates the effectiveness of our proposed method for few-shot image generation and downstream visual applications with limited data. Code is available at https://github.com/edward3862/LoFGAN-pytorch.

For agents

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

get_harvested_code_for_paper("Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper")
get_code_for_paper("Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper")
have("Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper")

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

curl https://syntology.ai/api/ran/Gu_LoFGAN_Fusing_Local_Representations_for_Few-Shot_Image_Generation_ICCV_2021_paper.json

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

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

Connect an agent — have() is free.