SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1812.09916 · 2018

Improving MMD-GAN Training with Repulsive Loss Function

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/1812.09916.json · badge: /api/ran/1812.09916.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
richardwth/MMD-GAN canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
average_tower_grads Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/graph_func.py
code served (permissive licence) · get_code("e255f546eb51ae30")
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. 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 tensorflow as tf
import numpy as np

# Create small gradient and variable pairs for multiple towers
tower_grads = []

# Tower 1: 2 (gradient, variable) tuples
tower_1 = []
var_1 = tf.Variable(np.random.randn(4, 3), dtype=tf.float32)
grad_1 = tf.constant(np.random.randn(4, 3), dtype=tf.float32)
tower_1.append((grad_1, var_1))

var_2 = tf.Variable(np.random.randn(5,), dtype=tf.float32)
grad_2 = tf.constant(np.random.randn(5,), dtype=tf.float32)
tower_1.append((grad_2, var_2))

tower_grads.append(tower_1)

# Tower 2: 2 (gradient, variable) tuples (same variables, different gradients)
tower_2 = []
grad_1_t2 = tf.constant(np.random.randn(4, 3), dtype=tf.float32)
tower_2.append((grad_1_t2, var_1))

grad_2_t2 = tf.constant(np.random.randn(5,), dtype=tf.float32)
tower_2.append((grad_2_t2, var_2))

tower_grads.append(tower_2)

ARGS = {
    "tower_grads": tower_grads
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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
bias_initializer Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/layer_func.py
code served (permissive licence) · get_code("18fcbff51eccaf48")
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 Zeros. 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 tensorflow as tf

ARGS = {
    "init_b_scale": 0.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Zeros — a Zeros output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Zeros 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_files_in_child_folders Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/input_func.py
code served (permissive licence) · get_code("9f0f284ad1588861")
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 os
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create child folders with some test files
child_folder_1 = os.path.join(temp_dir, "folder1")
child_folder_2 = os.path.join(temp_dir, "folder2")
os.makedirs(child_folder_1)
os.makedirs(child_folder_2)

# Create test files with JPEG extension
open(os.path.join(child_folder_1, "image1.JPEG"), 'w').close()
open(os.path.join(child_folder_1, "image2.JPEG"), 'w').close()
open(os.path.join(child_folder_1, "other.txt"), 'w').close()

open(os.path.join(child_folder_2, "photo1.JPEG"), 'w').close()
open(os.path.join(child_folder_2, "photo2.JPEG"), 'w').close()
open(os.path.join(child_folder_2, "photo3.JPEG"), 'w').close()

ARGS = {
    'parent_folder': temp_dir,
    'file_extension': 'JPEG',
    'do_sort': 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 — 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
kron_by_reshape Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/math_func.py
code served (permissive licence) · get_code("47bf2bd6f4c07778")
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 2, dtype family float, shape (8, 15) 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 tensorflow as tf

# Test with numpy arrays
mat1_np = np.random.randn(2, 3)
mat2_np = np.random.randn(4, 5)

ARGS = {
    "mat1": mat1_np,
    "mat2": mat2_np,
    "mat_shape": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (8, 15) — shape (8, 15) 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
mean_cov_np Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/math_func.py
code served (permissive licence) · get_code("37a70070238648d3")
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

# Create a small 2D array for testing
# Shape: (5, 3) - 5 samples, 3 variables
x = np.random.randn(5, 3).astype(np.float32)

ARGS = {
    "x": x
}
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
raw_image_to_np Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/input_func.py
code served (permissive licence) · get_code("57976e3d8ed9ad0a")
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 (3, 80, 100) 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
import os.path
import tempfile
import numpy as np
from PIL import Image

# Create a temporary directory for test images
temp_dir = tempfile.mkdtemp()

# Create a simple test image (RGB, 100x80 pixels)
test_image_path = os.path.join(temp_dir, 'test_image.png')
test_image = Image.new('RGB', (100, 80), color=(255, 0, 0))
test_image.save(test_image_path)

# Create a temporary folder for saving images
save_folder = os.path.join(temp_dir, 'output')
os.makedirs(save_folder, exist_ok=True)

ARGS = {
    'image_file': test_image_path,
    'image_format': 'NCHW',
    'resize': None,
    'crop': None,
    'dtype': np.uint8,
    'save_image': False,
    'save_folder': save_folder,
    'save_name': 'output.png'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — 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 (3, 80, 100) — shape (3, 80, 100) 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
scale_range Ran
ran on a synthesized input
richardwth/MMD-GAN/GeneralTools/math_func.py
code served (permissive licence) · get_code("c3836b2356ce9774")
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 2, dtype family float, shape (4, 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

# Create a small numpy matrix for testing
# Using distinct dimensions (4 rows, 3 columns) for shape probing
x = np.array([
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0],
    [10.0, 11.0, 12.0]
], dtype=np.float32)

ARGS = {
    "x": x,
    "scale_min": -1.0,
    "scale_max": 1.0,
    "axis": 1
}
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 2, dtype family float, shape (4, 3) — shape (4, 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
create_variable Not yet run
unverified (harvested, no recorded run)
richardwth/MMD-GAN/GeneralTools/graph_func.py
code served (permissive licence) · get_code("3c3e116e015d542b")
How it ran

no invocation recorded.

xavier_init Not yet run
unverified (harvested, no recorded run)
richardwth/MMD-GAN/GeneralTools/graph_func.py
code served (permissive licence) · get_code("b38f1ddd69e392d9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 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 9 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-23.

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 nets (GANs) are widely used to learn the data sampling process and their performance may heavily depend on the loss functions, given a limited computational budget. This study revisits MMD-GAN that uses the maximum mean discrepancy (MMD) as the loss function for GAN and makes two contributions. First, we argue that the existing MMD loss function may discourage the learning of fine details in data as it attempts to contract the discriminator outputs of real data. To address this issue, we propose a repulsive loss function to actively learn the difference among the real data by simply rearranging the terms in MMD. Second, inspired by the hinge loss, we propose a bounded Gaussian kernel to stabilize the training of MMD-GAN with the repulsive loss function. The proposed methods are applied to the unsupervised image generation tasks on CIFAR-10, STL-10, CelebA, and LSUN bedroom datasets. Results show that the repulsive loss function significantly improves over the MMD loss at no additional computational cost and outperforms other representative loss functions. The proposed methods achieve an FID score of 16.21 on the CIFAR-10 dataset using a single DCGAN network and spectral normalization.

For agents

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

get_harvested_code_for_paper("1812.09916")
get_code_for_paper("1812.09916")
have("1812.09916")

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

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

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

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

Connect an agent — have() is free.