CFG-GAN: Composite functional gradient learning of generative adversarial models
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

CFG for GAN in C++

This is a C++ implementation of composite functional gradient learning of generative adversarial models, described in our ICML paper:

System requirements
To run this code, your system must have the following:

  • a CUDA-capable GPU with 12GB or larger device memory (e.g., Tesla P100). (5GB device memory will do for small 32x32 images, though.)
  • CUDA 8.0 or higher.
  • Testing was done with gnu g++ and CUDA 8.0 on Linux.
    I don't know how to run it on Windows though it should be possible.

What you can do

  • Training of image generation models using the xICFG algorithm of the paper above.
  • Generation of images using a model trained with xICFG.
  • Evaluation of image quality, using classifiers (pre-trained and used in the paper).


  1. Go to bin/ and customize makefile there if needed; see the beginning of makefile for instructions.
    Build executables by entering make at bin/.
  2. To test the executable, go to test/ and enter ./ Dreal-Dgen should gradually go down if the executable was built correctly.
  3. Try out *.sh at `test/'.

Here is slightly more technical details.

Q. Do you have a tensorflow or pyTorch version of this code?
A. No. Please let me know if you've made one.

Q. Is there a python wrapper for this code?
A. No. Instead, you have shell scripts (test/*.sh). The network architecture and training/generation parameters can be changed by changing the shell scripts.

Q. Why C++?
A. For historical reasons. But don't worry, you don't have to read it if you just want to use this code.

Q. I just want to see your xICFG implementation as a reference for developing my own code for doing xICFG. Which source file should I look at?
A. Please see "Source code" in doc/

Data Source: The data files included here or downloaded by the scripts here were derived from MNIST and SVHN.
Note that the LSUN datasets used in the paper are not provided due to their sizes.

License: This program is free software issued under the GNU General Public License V3.

Note: This repository provides a snapshot of research code, which is constantly changing elsewhere for research purposes. For this reason, it is very likely that pull requests (including typo corrections) will be declined.