Papers › Self-Attention Generative Adversarial Networks

Self-Attention Generative Adversarial Networks

21 May 2018arXiv 2018 5arXiv:1805.08318archive 2025-07-28

Han Zhang, Ian Goodfellow, Dimitris Metaxas, Augustus Odena

In this paper, we propose the Self-Attention Generative Adversarial Network (SAGAN) which allows attention-driven, long-range dependency modeling for image generation tasks. Traditional convolutional GANs generate high-resolution details as a function of only spatially local points in lower-resolution feature maps. In SAGAN, details can be generated using cues from all feature locations. Moreover, the discriminator can check that highly detailed features in distant portions of the image are consistent with each other. Furthermore, recent work has shown that generator conditioning affects GAN performance. Leveraging this insight, we apply spectral normalization to the GAN generator and find that this improves training dynamics. The proposed SAGAN achieves the state-of-the-art results, boosting the best published Inception score from 36.8 to 52.52 and reducing Frechet Inception distance from 27.62 to 18.65 on the challenging ImageNet dataset. Visualization of the attention layers shows that the generator leverages neighborhoods that correspond to object shapes rather than local regions of fixed shape.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1805.08318")

Code

Syntology Ran 18 of 81 code samples harvested from 17 repositories linked to this paper; 63 have no recorded run. Of those that ran: 2 ran · honoured contract; 3 ran · our draft was wrong; 1 ran · fixture could not drive it; 12 ran with no contract checked.

By repository: official repository: 8 samples from 1 repository, 0 ran; community (archive-listed): 72 samples from 16 repositories, 17 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

48 repositories listed; official and paper-mentioned ones first.

brain-research/self-attention-gan officialmentioned in papermentioned on GitHubtfApache-2.0 report
ANIME305/Anime-GAN mentioned on GitHubtf report
ANIME305/Anime-GAN-tensorflow mentioned on GitHubtf report
Mmhmmmmm/ylg_pytorch mentioned on GitHubpytorch report
Mmhmmmmm/ylg_pytorvh mentioned on GitHubpytorch report
Soldie/DeOldify-colorir-imagens-antigas mentioned on GitHubpytorchMIT report
akanimax/attn_gan_pytorch mentioned on GitHubpytorchMIT report
alfagao/DeOldify mentioned on GitHubpytorchMIT report
alhasan-abdellatif/cgans mentioned on GitHubpytorch report
bayraktarbaris/SNGAN mentioned on GitHubpytorch report
franknb/Self-attention-DCGAN mentioned on GitHubpytorch report
heykeetae/Self-Attention-GAN mentioned on GitHubpytorchnot reachable when probed 2026-09-18 — repositories for recent papers often appear after camera-ready report
hinofafa/Self-Attention-GAN mentioned on GitHubpytorch report
hinofafa/Self-Attention-HearthStone-GAN mentioned on GitHubpytorch report
hiyouga/SAGAN-PyTorch mentioned on GitHubpytorchMIT report
ilyakava/gan mentioned on GitHubtfApache-2.0 report
jantic/DeOldify mentioned on GitHubpytorchMIT report
jher123/GAN-experiments mentioned on GitHubpytorch report
jher123/WGAN-experiments mentioned on GitHubpytorch report
jugatsingh/self_attention_video mentioned on GitHubpytorch report
kenanidris/deoldify mentioned on GitHubtfMIT report
kiban/models mentioned on GitHub report
kiyohiro8/SelfAttentionGAN mentioned on GitHub report
kpandey008/SAGAN mentioned on GitHubpytorchMIT report
llvictorll/AS mentioned on GitHubpytorch report
ncuzzy/mygan mentioned on GitHubpytorchnot reachable when probed 2026-09-18 — repositories for recent papers often appear after camera-ready report
rahulkulhalli/ISIC2019 mentioned on GitHubpytorchMIT report
recluse27/Colorizator mentioned on GitHubtfMIT report
rosinality/sagan-pytorch mentioned on GitHubpytorch report
sdoria/SimpleSelfAttention mentioned on GitHubpytorch report
shaoanlu/faceswap-GAN mentioned on GitHubtf report
vijishmadhavan/ArtLine mentioned on GitHubpytorchMIT report
vijishmadhavan/SkinDeep mentioned on GitHubpytorchApache-2.0 report
voletiv/self-attention-GAN-pytorch mentioned on GitHubpytorchMIT report
weishenho/SAGAN-with-relativistic mentioned on GitHubpytorch report
yanqi1811/self-attention mentioned on GitHubpytorch report
zhusiling/SAGAN mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

81 samples harvested; 18 ran; 2 honoured the contract we drafted; 63 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · honoured contract
3ran · our draft was wrong
1ran · fixture could not drive it
12ran
63unverified

Licence: 1 of the 81 samples is pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 17 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

conv2d brain-research/self-attention-gan/ops.py official repository unverified Apache-2.0 (permissive) · 77abc303c4715e0c · report
deconv2d brain-research/self-attention-gan/ops.py official repository unverified Apache-2.0 (permissive) · 5dd971c70bb05143 · report
dsample brain-research/self-attention-gan/discriminator.py official repository unverified Apache-2.0 (permissive) · 3c8a8a1b83ec5aea · report
linear brain-research/self-attention-gan/ops.py official repository unverified Apache-2.0 (permissive) · 93ecfc45883b8b85 · report
make_z_normal brain-research/self-attention-gan/utils_ori.py official repository unverified Apache-2.0 (permissive) · db0b51d579b0a8de · report
upscale brain-research/self-attention-gan/generator.py official repository unverified Apache-2.0 (permissive) · cc8856910cbff95a · report
usample brain-research/self-attention-gan/generator.py official repository unverified Apache-2.0 (permissive) · 83eea1b3ff49a808 · report
usample_tpu brain-research/self-attention-gan/generator.py official repository unverified Apache-2.0 (permissive) · d74eb1a1b0618351 · report
accuracy ChristophReich1996/Semantic_Pyramid_for_Image_Generation/vgg_16_train.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · 18badd533b52adb3 · report
conv sdoria/SimpleSelfAttention/xresnet.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · c9a6012d7fbd67dd · report
get_trainable_variables ilyakava/gan/tensorflow_gan/python/contrib_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 49e2b0cc4b0c854f · report
get_variables_by_name ilyakava/gan/tensorflow_gan/python/contrib_utils.py community (archive-listed) ran Apache-2.0 (permissive) · bfe05de19b4eb8d1 · report
image_grid ilyakava/gan/tensorflow_gan/python/eval/eval_utils.py community (archive-listed) ran Apache-2.0 (permissive) · c2576a700c35ebba · report
is_image_file Atmosphere-art/Self-Attention-GAN/dataset.py community (archive-listed) ran MIT (permissive) · 4e6a8faaf8e44abe · report
kl_divergence ilyakava/gan/tensorflow_gan/python/eval/classifier_metrics.py community (archive-listed) ran Apache-2.0 (permissive) · a3e29c3eb31126b7 · report
leaky_relu rosinality/sagan-pytorch/model.py community (archive-listed) ran · honoured contract fingerprinted Apache-2.0 (permissive) · de6376e3c77191a9 · report
python_image_grid ilyakava/gan/tensorflow_gan/python/eval/eval_utils.py community (archive-listed) ran Apache-2.0 (permissive) · 3c1810a3f62b3156 · report
run_classifier_fn ilyakava/gan/tensorflow_gan/python/eval/classifier_metrics.py community (archive-listed) ran Apache-2.0 (permissive) · c9b8371a08cafd98 · report
sample_and_run_classifier_fn ilyakava/gan/tensorflow_gan/python/eval/classifier_metrics.py community (archive-listed) ran Apache-2.0 (permissive) · e56d29a30182c70a · report
spectral_init rosinality/sagan-pytorch/model.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 6c51f01ab7abcc0d · report
spectral_norm rosinality/sagan-pytorch/model.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · a493780508978abe · report
stargan_prediction_input_fn_wrapper ilyakava/gan/tensorflow_gan/python/estimator/stargan_estimator.py community (archive-listed) ran Apache-2.0 (permissive) · 86ee4730f89c1466 · report
wasserstein_discriminator_loss ilyakava/gan/tensorflow_gan/python/losses/losses_impl.py community (archive-listed) ran Apache-2.0 (permissive) · 6dfacdb4f7f296a6 · report
wasserstein_generator_loss ilyakava/gan/tensorflow_gan/python/losses/losses_impl.py community (archive-listed) ran Apache-2.0 (permissive) · ef511aaa7c479fd0 · report
wasserstein_hinge_discriminator_loss ilyakava/gan/tensorflow_gan/python/losses/losses_impl.py community (archive-listed) ran Apache-2.0 (permissive) · 3160840ade588e25 · report
args_to_gan_model ilyakava/gan/tensorflow_gan/python/losses/tuple_losses.py community (archive-listed) unverified Apache-2.0 (permissive) · 3ed7cb04ca358824 · report
blur IEWbgfnYDwHRoRRSKtkdyMDUzgdwuBYgDKtDJWd/doldy/app_utils.py community (archive-listed) unverified MIT (permissive) · 42067c777f73e7fe · report
configure_device kpandey008/SAGAN/config.py community (archive-listed) unverified MIT (permissive) · d0dbc1ec9e12116f · report
conv1d sdoria/SimpleSelfAttention/xresnet.py community (archive-listed) unverified Apache-2.0 (permissive) · 9529ce8993bceed1 · report
cut_model alfagao/DeOldify/fastai/model.py community (archive-listed) unverified MIT (permissive) · 3ef87d02964ebff2 · report
denorm voletiv/self-attention-GAN-pytorch/utils.py community (archive-listed) unverified MIT (permissive) · 6e16337c88174e00 · report
denorm Atmosphere-art/Self-Attention-GAN/utils.py community (archive-listed) unverified MIT (permissive) · 9c7967df1b87b856 · report
discriminator_fn ilyakava/gan/tensorflow_gan/python/estimator/tpu_gan_estimator_test_lib.py community (archive-listed) unverified Apache-2.0 (permissive) · 1341ccc8c51a764e · report
download IEWbgfnYDwHRoRRSKtkdyMDUzgdwuBYgDKtDJWd/doldy/app_utils.py community (archive-listed) unverified MIT (permissive) · e76e1f39c42ee168 · report
fbeta_torch alfagao/DeOldify/fastai/losses.py community (archive-listed) unverified MIT (permissive) · bddb0f7db928e1b9 · report
find_classes Atmosphere-art/Self-Attention-GAN/dataset.py community (archive-listed) unverified MIT (permissive) · a991cda315bdf446 · report
generate_random_filename IEWbgfnYDwHRoRRSKtkdyMDUzgdwuBYgDKtDJWd/doldy/app_utils.py community (archive-listed) unverified MIT (permissive) · 0da8e3611f2915d1 · report
generator_fn ilyakava/gan/tensorflow_gan/python/estimator/tpu_gan_estimator_test_lib.py community (archive-listed) unverified Apache-2.0 (permissive) · ace1970711646371 · report
get_act_fn akanimax/attn_gan_pytorch/attn_gan_pytorch/Utils.py community (archive-listed) unverified MIT (permissive) · 07bea8a5df5a9e59 · report
get_config akanimax/attn_gan_pytorch/attn_gan_pytorch/ConfigManagement.py community (archive-listed) unverified MIT (permissive) · 7b64c2c40ebe4e1d · report
get_confirm_token taki0112/Self-Attention-GAN-Tensorflow/download.py community (archive-listed) unverified MIT (permissive) · 135b3dc835ffe6ad · report
get_cv_idxs alfagao/DeOldify/fastai/dataset.py community (archive-listed) unverified MIT (permissive) · 149a12c4dc7845d3 · report
get_data_loader akanimax/attn_gan_pytorch/samples/data_processing/DataLoader.py community (archive-listed) unverified MIT (permissive) · 4c285e4ad37fd444 · report
get_dataloaders rahulkulhalli/ISIC2019/utils.py community (archive-listed) unverified MIT (permissive) · ad810d34df32ec81 · report
get_emb alfagao/DeOldify/fastai/column_data.py community (archive-listed) unverified MIT (permissive) · 2e0a726be884ad1d · report
get_eval_estimator_spec ilyakava/gan/tensorflow_gan/python/estimator/gan_estimator.py community (archive-listed) unverified Apache-2.0 (permissive) · 6b36eef1846a9c6e · report
get_layer akanimax/attn_gan_pytorch/attn_gan_pytorch/Utils.py community (archive-listed) unverified MIT (permissive) · fb18a372c2d6ae7c · report
get_predict_estimator_spec ilyakava/gan/tensorflow_gan/python/estimator/tpu_gan_estimator.py community (archive-listed) unverified Apache-2.0 (permissive) · f9934d2088fd316e · report
get_pretrained_resnet_base Soldie/DeOldify-colorir-imagens-antigas/fasterai/modules.py community (archive-listed) unverified MIT (permissive) · 046e55f2369394f8 · report
get_tensor alfagao/DeOldify/fastai/dataloader.py community (archive-listed) unverified MIT (permissive) · 90dbf24c9ddd7f1d · report
get_transform akanimax/attn_gan_pytorch/samples/data_processing/DataLoader.py community (archive-listed) unverified MIT (permissive) · e36470391de100a1 · report
get_variables ilyakava/gan/tensorflow_gan/python/contrib_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 8257e435f9a8eec2 · report
get_watermarked jantic/DeOldify/deoldify/visualize.py community (archive-listed) unverified MIT (permissive) · 456672524c536ea3 · report
image_reshaper ilyakava/gan/tensorflow_gan/python/eval/eval_utils.py community (archive-listed) unverified Apache-2.0 (permissive) · 1ea274c92e014f1e · report
is_iter alfagao/DeOldify/fastai/core.py community (archive-listed) unverified MIT (permissive) · 0e0f18750a4cb287 · report
is_listy alfagao/DeOldify/fastai/core.py community (archive-listed) unverified MIT (permissive) · 41ffbd7edb63900f · report
load_cifar10 taki0112/Self-Attention-GAN-Tensorflow/utils.py community (archive-listed) unverified MIT (permissive) · 51fd45e7747d0b80 · report
load_data hiyouga/SAGAN-PyTorch/data_utils.py community (archive-listed) unverified MIT (permissive) · df604797d5e1e1f4 · report
load_data taki0112/Self-Attention-GAN-Tensorflow/utils.py community (archive-listed) unverified MIT (permissive) · 2f9e84171dcaf423 · report
load_mnist taki0112/Self-Attention-GAN-Tensorflow/utils.py community (archive-listed) unverified MIT (permissive) · 7fddf2b174e60ac1 · report
make_dataloader voletiv/self-attention-GAN-pytorch/utils.py community (archive-listed) unverified MIT (permissive) · d605248fc0b2740e · report
make_dataset Atmosphere-art/Self-Attention-GAN/dataset.py community (archive-listed) unverified MIT (permissive) · 776ca5e6e79753e3 · report
make_grid rahulkulhalli/ISIC2019/utils.py community (archive-listed) unverified MIT (permissive) · 696143e37ed7ad3e · report
make_transform voletiv/self-attention-GAN-pytorch/utils.py community (archive-listed) unverified MIT (permissive) · 01aaeccd433501f0 · report
num_features alfagao/DeOldify/fastai/model.py community (archive-listed) unverified MIT (permissive) · 8610d8e65ac9e50c · report
opt_params alfagao/DeOldify/fastai/layer_optimizer.py community (archive-listed) unverified MIT (permissive) · 6830018a9acaef0d · report
parse2tuple akanimax/attn_gan_pytorch/attn_gan_pytorch/ConfigManagement.py community (archive-listed) unverified MIT (permissive) · 81eef2989e68e1bb · report
prepare_mask_and_masked_image vijishmadhavan/SkinDeep/src/pipeline_stable_diffusion_controlnet_inpaint.py community (archive-listed) unverified Apache-2.0 (permissive) · 2adc88ed4c50017c · report
read_dir alfagao/DeOldify/fastai/dataset.py community (archive-listed) unverified MIT (permissive) · 2b102de695eaf51f · report
read_loss_log akanimax/attn_gan_pytorch/samples/generate_loss_plots.py community (archive-listed) unverified MIT (permissive) · d5151aa5668d7556 · report
resize_image vijishmadhavan/SkinDeep/tattoorem.py community (archive-listed) unverified Apache-2.0 (permissive) · 9519c43c0017c576 · report
resize_imgs alfagao/DeOldify/fastai/dataset.py community (archive-listed) unverified MIT (permissive) · bc81f063327a2b2a · report
seed_everything kpandey008/SAGAN/config.py community (archive-listed) unverified MIT (permissive) · c58d89114d55c178 · report
sn_embedding voletiv/self-attention-GAN-pytorch/sagan_models.py community (archive-listed) unverified MIT (permissive) · 9dadf7efa8619d2e · report
snconv2d voletiv/self-attention-GAN-pytorch/sagan_models.py community (archive-listed) unverified MIT (permissive) · 572d43d0e50a2023 · report
snlinear voletiv/self-attention-GAN-pytorch/sagan_models.py community (archive-listed) unverified MIT (permissive) · d7e3fc2fa558d6ef · report
sum_geom alfagao/DeOldify/fastai/core.py community (archive-listed) unverified MIT (permissive) · 87c95fa55e0db542 · report
torch_item alfagao/DeOldify/fastai/model.py community (archive-listed) unverified MIT (permissive) · 3f8c44e7445adaad · report
validate ChristophReich1996/Semantic_Pyramid_for_Image_Generation/vgg_16_train.py community (archive-listed) unverified MIT (permissive) · 59776bf8e0342c7d · report
zip_strict_ alfagao/DeOldify/fastai/layer_optimizer.py community (archive-listed) unverified MIT (permissive) · b80bba5071349f52 · report
noop identical code first harvested elsewhere ran · honoured contract fingerprinted licence of this copy not recorded · 5e2ed23acb71ee11 · report

Tasks

Conditional Image GenerationImage Generation

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Conditional Image Generation ImageNet 128x128 SAGAN FID 18.65 #20 of 22 Archive leaderboard report
Conditional Image Generation ImageNet 128x128 SAGAN Inception score 52.52 #20 of 22 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: SAGAN

1x1 ConvolutionAdamBatch NormalizationConvolutionGAN Hinge LossSAGANSoftmaxSpectral Normalization

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections