SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.04589 · ICLR · 2022

ViTGAN: Training GANs with Vision Transformers

Han Zhang, Lu Jiang, Zhuowen Tu, Kwonjoon Lee, Huiwen Chang, Ce Liu

arXiv · PDF · Open in the Atlas

Code that ran

16 of 18 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (12 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 13 have no contract verdict; 3 failures of our instrument; 2 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/2107.04589.json · badge: /api/ran/2107.04589.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
mlpc-ucsd/ViTGAN canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
lucidrains/parti-pytorch community
Papers with Code archive
8 ran · 1 no recorded run
wilile26811249/ViTGAN reimplementation (classifier label)
classifier basis: classifier_2025
6 ran · 1 no recorded run
teodorToshkov/ViTGAN-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("e2a8ba11e0a8cc86")
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 an instance of its own class, Attention: the run constructed the object and did not call it, so no result was computed. 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 torch
from torch import nn

torch.manual_seed(0)

ARGS = {
    "dim": 4,
    "heads": 2,
    "dim_head": 2,
    "fmap_size": 3,
    "rel_pos_bias": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, einops_exts, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Attention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Attention 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
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("d4e0313631ba260f")
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 an instance of its own class, Attention: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "dim": 8,
    "num_heads": 2,
    "dim_head": None,
    "discriminator": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Attention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Attention 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
ChanLayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("f5b6aedd01aee2e5")
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 an instance of its own class, ChanLayerNorm: the run constructed the object and did not call it, so no result was computed. 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 torch
from torch import nn

torch.manual_seed(0)

class ChanLayerNorm(nn.Module):

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

    def forward(self, x):
        var = torch.var(x, dim=1, unbiased=False, keepdim=True)
        mean = torch.mean(x, dim=1, keepdim=True)
        return (x - mean) * (var + self.eps).rsqrt() * self.gamma


ARGS = {
    'dim': 4,
    'eps': 1e-05
}
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 ChanLayerNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ChanLayerNorm 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
FeedForward Ran
ran; our contract draft was wrong, not the code
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("fc258e8fab867fb8")
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 Sequential. 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 torch
from torch import nn

torch.manual_seed(0)

# FeedForward takes two parameters: dim and mult
# dim: the channel dimension (used throughout the model)
# mult: the multiplier for the hidden dimension in the feedforward

ARGS = {
    'dim': 4,
    'mult': 4
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
GEncoderBlock Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("b8553e30e2a59605")
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 an instance of its own class, GEncoderBlock: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "dim": 8,
    "num_heads": 2,
    "dim_head": 4,
    "dropout": 0.1,
    "mlp_ratio": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GEncoderBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GEncoderBlock 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
GTransformerEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("db9e09fa314a8450")
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 an instance of its own class, GTransformerEncoder: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn
from einops import rearrange, repeat

torch.manual_seed(0)

class MLP(nn.Module):
    def __init__(self, in_feat, hid_feat=None, out_feat=None, dropout=0.0):
        super().__init__()
        if not hid_feat:
            hid_feat = in_feat
        if not out_feat:
            out_feat = in_feat
        self.linear1 = nn.Linear(in_feat, hid_feat)
        self.activation = nn.GELU()
        self.linear2 = nn.Linear(hid_feat, out_feat)
        self.dropout = nn.Dropout(dropout)

    def forward(self, x):
        x = self.linear1(x)
        x = self.activation(x)
        x = self.dropout(x)
        x = self.linear2(x)
        return self.dropout(x)

class SLN(nn.Module):
    def __init__(self, num_features):
        super(SLN, self).__init__()
        self.ln = nn.LayerNorm(num_features)
        self.gamma = nn.Parameter(torch.randn(1, 1, 1))
        self.beta = nn.Parameter(torch.randn(1, 1, 1))

    def forward(self, hl, w):
        return self.gamma * w * self.ln(hl) + self.beta * w

class Attention(nn.Module):
    def __init__(self, dim, num_heads=4, dim_head=None, discriminator=False):
        super(Attention, self).__init__()
        self.num_heads = num_heads
        self.dim_head = int(dim / num_heads) if dim_head is None else dim_head
        self.weight_dim = self.num_heads * self.dim_head
        self.to_qkv = nn.Linear(dim, self.weight_dim * 3, bias=False)
        self.scale_factor = dim ** (-0.5)
        self.discriminator = discriminator
        self.w_out = nn.Linear(self.weight_dim, dim, bias=True)
        if discriminator:
            u, s, v = torch.svd(self.to_qkv.weight)
            self.init_spect_norm = torch.max(s)

    def forward(self, x):
        assert x.dim() == 3
        if self.discriminator:
            u, s, v = torch.svd(self.to_qkv.weight)
            self.to_qkv.weight = torch.nn.Parameter(self.to_qkv.weight * self.init_spect_norm / torch.max(s))
        qkv = self.to_qkv(x)
        q, k, v = tuple(rearrange(qkv, 'b t (d k h) -> k b h t d', k=3, h=self.num_heads))
        if self.discriminator:
            attn = torch.cdist(q, k, p=2)
        else:
            attn = torch.einsum('... i d, ... j d -> ... i j', q, k)
        scale_attn = attn * self.scale_factor
        scale_attn_score = torch.softmax(scale_attn, dim=-1)
        result = torch.einsum('... i j, ... j d -> ... i d', scale_attn_score, v)
        result = rearrange(result, 'b h t d -> b t (h d)')
        return self.w_out(result)

class GEncoderBlock(nn.Module):
    def __init__(self, dim, num_heads=4, dim_head=None, dropout=0.0, mlp_ratio=4):
        super(GEncoderBlock, self).__init__()
        self.attn = Attention(dim, num_heads, dim_head)
        self.dropout = nn.Dropout(dropout)
        self.norm1 = SLN(dim)
        self.norm2 = SLN(dim)
        self.mlp = MLP(dim, dim * mlp_ratio, dropout=dropout)

    def forward(self, hl, x):
        hl_temp = self.dropout(self.attn(self.norm1(hl, x))) + hl
        hl_final = self.mlp(self.norm2(hl_temp, x)) + hl_temp
        return (x, hl_final)

class GTransformerEncoder(nn.Module):
    def __init__(self, dim, blocks=6, num_heads=8, dim_head=None, dropout=0):
        super(GTransformerEncoder, self).__init__()
        self.blocks = self._make_layers(dim, blocks, num_heads, dim_head, dropout)

    def _make_layers(self, dim, blocks=6, num_heads=8, dim_head=None, dropout=0):
        layers = []
        for _ in range(blocks):
            layers.append(GEncoderBlock(dim, num_heads, dim_head, dropout))
        return nn.Sequential(*layers)

    def forward(self, hl, x):
        for block in self.blocks:
            x, hl = block(hl, x)
        return (x, hl)

ARGS = {
    'dim': 4,
    'blocks': 2,
    'num_heads': 2,
    'dim_head': None,
    'dropout': 0.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type GTransformerEncoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a GTransformerEncoder 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
MLP Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("d1fb8f114fe3bf13")
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 an instance of its own class, MLP: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'in_feat': 4,
    'hid_feat': 8,
    'out_feat': 3,
    'dropout': 0.1
}
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 MLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLP 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
PEG Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("5fe00770f0011e28")
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 an instance of its own class, PEG: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# PEG expects:
# - dim: int (number of channels)
# - kernel_size: int (default 3)
# The forward method expects x to be a 4D tensor (batch, channels, height, width)

peg_model = nn.Module()

ARGS = {
    "dim": 4,
    "kernel_size": 3,
}
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 PEG — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PEG 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
RelPosBias2d Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("64f19fade720d0a0")
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 an instance of its own class, RelPosBias2d: the run constructed the object and did not call it, so no result was computed. 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 torch
from torch import nn

torch.manual_seed(0)

ARGS = {
    'size': 4,
    'heads': 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RelPosBias2d — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RelPosBias2d 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
SLN Ran
ran on a synthesized input
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("7bf61b3936e50c87")
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 3, 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

# INIT_ARGS: parameters for SLN.__init__
INIT_ARGS = {
    'num_features': 8
}

# ARGS: parameters for SLN.forward
ARGS = {
    'hl': torch.randn(2, 5, 8),  # batch=2, seq_len=5, features=8
    'w': torch.randn(2, 5, 1)     # batch=2, seq_len=5, broadcast dim=1
}
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 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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)
SPT Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("ef119489abae949f")
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 an instance of its own class, SPT: the run constructed the object and did not call it, so no result was computed. 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 torch
from torch import nn

torch.manual_seed(0)

# SPT.__init__ takes: dim, patch_size, channels
# SPT.forward takes: x (a tensor)
# The forward method expects x to have shape (b, c, h, w) where:
#   - b is batch size
#   - c is channels
#   - h, w are spatial dimensions that are divisible by patch_size

# Looking at the forward method:
# - shifts are applied with F.pad, which pads the channel dimension
# - x_with_shifts concatenates x with 4 shifted versions, so dim becomes 5*c
# - to_patch_tokens rearranges with (h p1) (w p2) -> (p1 p2 c) h w
#   meaning h and w must be divisible by patch_size
# - patch_dim = patch_size * patch_size * 5 * channels

# Let's use:
# - batch_size = 2 (small)
# - channels = 3 (typical for images)
# - patch_size = 2 (small, divisible)
# - spatial dimensions: 4x4 (divisible by patch_size=2)

dim = 4
patch_size = 2
channels = 3
batch_size = 2
height = 4
width = 4

# Create input tensor: (batch, channels, height, width)
x = torch.randn(batch_size, channels, height, width)

ARGS = {
    'dim': dim,
    'patch_size': patch_size,
    'channels': channels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SPT — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SPT 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
SineLayer Ran
ran on a synthesized input · constructed an object; no result was computed
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("b4ad6aadc33ddbd3")
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 an instance of its own class, SineLayer: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

ARGS = {
    "in_features": 4,
    "out_features": 3,
    "bias": True,
    "is_first": False,
    "omega_0": 30
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SineLayer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SineLayer 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
SinusoidalPosEmb Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("df2561ae8a008410")
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 an instance of its own class, SinusoidalPosEmb: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn
from einops import rearrange

torch.manual_seed(0)

# The forward method expects x to be a tensor with shape (batch, channels, height, width)
# We need to create valid arguments for __init__

ARGS = {
    'dim': 4,
    'height_or_width': 3,
    'theta': 10000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SinusoidalPosEmb — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SinusoidalPosEmb 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
Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("9502a3bad7826863")
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 an instance of its own class, Transformer: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Define ARGS dict with all parameters for Transformer
ARGS = {
    'dim': 4,
    'layers': 2,
    'dim_head': 32,
    'heads': 8,
    'ff_mult': 4,
    'fmap_size': 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, einops_exts, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Transformer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Transformer 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
normalize_2nd_moment Ran
ran; our contract draft was wrong, not the code
teodorToshkov/ViTGAN-pytorch/models/vitgan_generator.py
code served (permissive licence) · get_code("1b999f986d09befe")
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
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Create a small tensor with batch size 2 and feature dimension 4
x = torch.randn(2, 4)

# Define ARGS dict with all parameters
ARGS = {
    "x": x,
    "dim": 1,
    "eps": 1e-08
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, numpy, 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
r1_loss Ran
ran; our contract draft was wrong, not the code
mlpc-ucsd/ViTGAN/train_stylegan2.py
code served (permissive licence) · get_code("0dacaab9f42c160b")
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 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
from torch import autograd

torch.manual_seed(0)

# Define a minimal discriminator that takes images and outputs a scalar per batch element
class MinimalDiscriminator(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(48, 1)  # 2*4*6 = 48 flattened features
    
    def forward(self, x):
        # x shape: (batch, channels, height, width)
        batch_size = x.shape[0]
        x_flat = x.reshape(batch_size, -1)
        return self.linear(x_flat)

# Define a minimal augmentation function
def augment_fn(images):
    # Simple augmentation: just return a scaled version
    return images * 0.95

# Create instances
D = MinimalDiscriminator()
images = torch.randn(2, 3, 4, 4)  # batch=2, channels=3, height=4, width=4

ARGS = {
    "D": D,
    "images": images,
    "augment_fn": augment_fn,
}
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 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
Generator Not yet run
unverified (harvested, no recorded run)
wilile26811249/ViTGAN/models.py
code served (permissive licence) · get_code("ffa338e5b0089e84")
How it ran

no invocation recorded.

ViTEncDec Not yet run
unverified (harvested, no recorded run)
lucidrains/parti-pytorch/parti_pytorch/vit_vqgan.py
code served (permissive licence) · get_code("1c988e9ef49a3005")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 later) and 16 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
normalize_2nd_moment 7 other papers
7 later
2206.09479 (2022-06)
StudioGAN: A Taxonomy and Benchmark of GANs for Image Synthesis
2305.12734 (2023-05)
EMEF: Ensemble Multi-Exposure Image Fusion
2308.11473 (2023-08)
IT3D: Improved Text-to-3D Generation with Explicit View Synthesis
and 4 more not named here
SineLayer
brick of this paper's assembly: helper
2 other papers
1 dated earlier, 1 later
2006.09661 (2020-06)
Implicit Neural Representations with Periodic Activation Functions
2206.04647 (2022-06)
VideoINR: Learning Video Implicit Neural Representation for Continuous Space-Time Super-Resolution

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

Recently, Vision Transformers (ViTs) have shown competitive performance on image recognition while requiring less vision-specific inductive biases. In this paper, we investigate if such performance can be extended to image generation. To this end, we integrate the ViT architecture into generative adversarial networks (GANs). For ViT discriminators, we observe that existing regularization methods for GANs interact poorly with self-attention, causing serious instability during training. To resolve this issue, we introduce several novel regularization techniques for training GANs with ViTs. For ViT generators, we examine architectural choices for latent and pixel mapping layers to facilitate convergence. Empirically, our approach, named ViTGAN, achieves comparable performance to the leading CNNbased GAN models on three datasets: CIFAR-10, CelebA, and LSUN bedroom. Our code is available online 1 .

For agents

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

get_harvested_code_for_paper("2107.04589")
get_code_for_paper("2107.04589")
have("2107.04589")

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

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

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

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

Connect an agent — have() is free.