SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.01209 · ICML · 2021

Generative Adversarial Transformers

C Zitnick, Drew Hudson

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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 3 have no contract verdict; 2 failures of our instrument; 1 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/2103.01209.json · badge: /api/ran/2103.01209.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
lucidrains/transganformer community
Papers with Code archive
5 ran · 1 no recorded run
FunctionStatusWhere it lives
ChanNorm Ran
ran on a synthesized input
lucidrains/transganformer/transganformer/transganformer.py
code served (permissive licence) · get_code("6202bbbd7907d938")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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
from torch import nn

class ChanNorm(nn.Module):

    def __init__(self, dim, eps=1e-05):
        super().__init__()
        self.eps = eps
        self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
        self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))

    def forward(self, x):
        std = torch.var(x, dim=1, unbiased=False, keepdim=True).sqrt()
        mean = torch.mean(x, dim=1, keepdim=True)
        return (x - mean) / (std + self.eps) * self.g + self.b


INIT_ARGS = {
    'dim': 4,
    'eps': 1e-05
}

ARGS = {
    'x': torch.randn(2, 4, 3, 5)
}

if __name__ == '__main__':
    model = ChanNorm(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Output:\n{output}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
FixedPositionalEmbedding Ran
ran on a synthesized input
lucidrains/transganformer/transganformer/transganformer.py
code served (permissive licence) · get_code("ba2f5a6aebc8fa85")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (1, 8, 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 torch
from torch import nn
from einops import rearrange, reduce, repeat

class FixedPositionalEmbedding(nn.Module):

    def __init__(self, dim):
        super().__init__()
        dim //= 2
        inv_freq = 1.0 / 10000 ** (torch.arange(0, dim, 2).float() / dim)
        self.register_buffer('inv_freq', inv_freq)

    def forward(self, x):
        h = torch.linspace(-1.0, 1.0, x.shape[-2], device=x.device).type_as(self.inv_freq)
        w = torch.linspace(-1.0, 1.0, x.shape[-1], device=x.device).type_as(self.inv_freq)
        sinu_inp_h = torch.einsum('i , j -> i j', h, self.inv_freq)
        sinu_inp_w = torch.einsum('i , j -> i j', w, self.inv_freq)
        sinu_inp_h = repeat(sinu_inp_h, 'h c -> () c h w', w=x.shape[-1])
        sinu_inp_w = repeat(sinu_inp_w, 'w c -> () c h w', h=x.shape[-2])
        sinu_inp = torch.cat((sinu_inp_w, sinu_inp_h), dim=1)
        emb = torch.cat((sinu_inp.sin(), sinu_inp.cos()), dim=1)
        return emb


INIT_ARGS = {
    'dim': 8
}

ARGS = {
    'x': torch.randn(1, 8, 4, 3)
}

if __name__ == '__main__':
    model = FixedPositionalEmbedding(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output dtype: {output.dtype}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, 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 (1, 8, 4, 3) — shape (1, 8, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
RotaryEmbedding Ran
ran on a synthesized input
lucidrains/transganformer/transganformer/transganformer.py
code served (permissive licence) · get_code("f655a887963da4f4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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
from torch import nn
from math import log2, floor, sqrt, log, pi
from einops import rearrange, reduce, repeat

def get_sin_cos(seq):
    n = seq.shape[0]
    x_sinu = repeat(seq, 'i d -> i j d', j=n)
    y_sinu = repeat(seq, 'j d -> i j d', i=n)
    sin = torch.cat((x_sinu.sin(), y_sinu.sin()), dim=-1)
    cos = torch.cat((x_sinu.cos(), y_sinu.cos()), dim=-1)
    sin, cos = map(lambda t: rearrange(t, 'i j d -> (i j) d'), (sin, cos))
    sin, cos = map(lambda t: repeat(t, 'n d -> () () n (d j)', j=2), (sin, cos))
    return (sin, cos)

def rotate_every_two(x):
    x = rearrange(x, '... (d j) -> ... d j', j=2)
    x1, x2 = x.unbind(dim=-1)
    x = torch.stack((-x2, x1), dim=-1)
    return rearrange(x, '... d j -> ... (d j)')

class RotaryEmbedding(nn.Module):

    def __init__(self, dim, downsample_keys=1):
        super().__init__()
        self.dim = dim
        self.downsample_keys = downsample_keys

    def forward(self, q, k):
        device, dtype, n = (q.device, q.dtype, int(sqrt(q.shape[-2])))
        seq = torch.linspace(-1.0, 1.0, steps=n, device=device)
        seq = seq.unsqueeze(-1)
        scales = torch.logspace(0.0, log(10 / 2) / log(2), self.dim // 4, base=2, device=device, dtype=dtype)
        scales = scales[*(None,) * (len(seq.shape) - 1), Ellipsis]
        seq = seq * scales * pi
        x = seq
        y = seq
        y = reduce(y, '(j n) c -> j c', 'mean', n=self.downsample_keys)
        q_sin, q_cos = get_sin_cos(x)
        k_sin, k_cos = get_sin_cos(y)
        q = q * q_cos + rotate_every_two(q) * q_sin
        k = k * k_cos + rotate_every_two(k) * k_sin
        return (q, k)


INIT_ARGS = {
    'dim': 8,
    'downsample_keys': 1,
}

ARGS = {
    'q': torch.randn(1, 1, 16, 8),
    'k': torch.randn(1, 1, 16, 8),
}

if __name__ == '__main__':
    model = RotaryEmbedding(**INIT_ARGS)
    q_out, k_out = model(**ARGS)
    print(f"q_out shape: {q_out.shape}")
    print(f"k_out shape: {k_out.shape}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
get_sin_cos Ran
ran; our contract draft was wrong, not the code
lucidrains/transganformer/transganformer/transganformer.py
code served (permissive licence) · get_code("ced642870818826e")
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
from einops import rearrange, repeat

torch.manual_seed(0)

# The function takes a single parameter 'seq'
# Looking at the body:
# - seq.shape[0] is accessed, so it needs to be a tensor
# - seq is used with repeat, sin(), cos() operations
# - It should be a 2D tensor (i, d) based on the einops operations

seq = torch.randn(2, 4)

ARGS = {
    'seq': seq
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, 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
rotate_every_two Ran
ran; our contract draft was wrong, not the code
lucidrains/transganformer/transganformer/transganformer.py
code served (permissive licence) · get_code("1ac67506c6a0368b")
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 2, dtype family float, shape (2, 4) 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
from einops import rearrange, reduce, repeat

torch.manual_seed(0)

# The function rotate_every_two takes a single parameter 'x' which is a tensor
# It rearranges the last dimension into pairs, swaps and negates them
# The tensor needs to have an even-sized last dimension to be rearranged into (d, j=2)

# Create a small tensor with batch size 2 and last dimension 4 (even, so it can be split into 2 pairs)
x = torch.randn(2, 4)

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
Attention Not yet run
unverified (harvested, no recorded run)
lucidrains/transganformer/transganformer/transganformer.py
code served (permissive licence) · get_code("82e38a4ffe03866d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 5 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
rotate_every_two
brick of this paper's assembly: helper
4 other papers
1 dated earlier, 3 later · 3 only as an assembly brick
2102.05095 (2021-02)
Is Space-Time Attention All You Need for Video Understanding?
2104.09864 (2021-04)
RoFormer: Enhanced Transformer with Rotary Position Embedding
2511.11090 (2025-11)
A Space-Time Transformer for Precipitation Nowcasting
and 1 more not named here

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

We introduce the GANformer, a novel and efficient type of transformer, and explore it for the task of visual generative modeling. The network employs a bipartite structure that enables longrange interactions across the image, while maintaining computation of linear efficiency, that can readily scale to high-resolution synthesis. It iteratively propagates information from a set of latent variables to the evolving visual features and vice versa, to support the refinement of each in light of the other, and encourage the emergence of compositional representations for objects and scenes. In contrast to the classic transformer architecture, it utilizes multiplicative integration that allows flexible region-based modulation, and can thus be seen as a multi-latent generalization of the successful StyleGAN network. We demonstrate the model's strength and robustness through a careful evaluation over a range of datasets, from simulated multi-object environments to rich real-world indoor and outdoor scenes, showing it attains stateof-the-art results in terms of image quality and diversity, while enjoying fast learning and better data-efficiency. Further qualitative and quantitative experiments offer an insight into the model's inner workings, revealing improved interpretability and stronger disentanglement, and illustrate the benefits and efficacy of our approach. An implementation of the model is available at https: //github.com/dorarad/gansformer.

For agents

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

get_harvested_code_for_paper("2103.01209")
get_code_for_paper("2103.01209")
have("2103.01209")

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

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

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

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

Connect an agent — have() is free.