SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1711.00937 · 2017

Neural Discrete Representation Learning

Oriol Vinyals, Aaron Van Den Oord, Koray Kavukcuoglu

arXiv · PDF · Open in the Atlas

Code that ran

64 of 80 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (35 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 50 have no contract verdict; 14 failures of our instrument; 16 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/1711.00937.json · badge: /api/ran/1711.00937.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
yjlolo/vae-audio community (classifier label)
classifier basis not recorded on the link
11 ran · 1 no recorded run
explainingai-code/VQVAE-Pytorch community
Papers with Code archive
6 ran · 1 no recorded run
ks2labs/modules community
Papers with Code archive
6 ran · 0 no recorded run
airalcorn2/vqvae-pytorch community
Papers with Code archive
5 ran · 1 no recorded run
joh-fischer/PlantLDM community
Papers with Code archive
5 ran · 0 no recorded run
MishaLaskin/vq-vae community
Papers with Code archive
4 ran · 1 no recorded run
andrecianflone/vector_quantization community
Papers with Code archive
4 ran · 1 no recorded run
nadavbh12/VQ-VAE community
Papers with Code archive
4 ran · 0 no recorded run
sisl/MultiAgentVariationalOcclusionInference community
not in the paper's declared repositories
3 ran · 2 no recorded run
wayexists02/vqvae-pytorch-impl community
not in the paper's declared repositories
3 ran · 2 no recorded run
sarus-tech/tf2-published-models community
not in the paper's declared repositories
2 ran · 0 no recorded run
archinetai/bitcodes-pytorch community
Papers with Code archive
1 ran · 0 no recorded run
unixpickle/vq-draw community
not in the paper's declared repositories
1 ran · 0 no recorded run
Geson-anko/VQ_AutoEncoder community
Papers with Code archive
1 ran · 0 no recorded run
bshall/VectorQuantizedCPC community
Papers with Code archive
1 ran · 0 no recorded run
bshall/ZeroSpeech community
Papers with Code archive
1 ran · 0 no recorded run
nicolaffETHZ/Brain2Word_paper community
Papers with Code archive
1 ran · 0 no recorded run
rhoposit/icassp2021 community
not in the paper's declared repositories
1 ran · 0 no recorded run
swasun/VQ-VAE-Speech community
not in the paper's declared repositories
1 ran · 0 no recorded run
swasun/VQ-VAE-images community
not in the paper's declared repositories
1 ran · 0 no recorded run
buaavrcg/LEGaussians community
Papers with Code archive
1 ran · 0 no recorded run
v-iashin/SpecVQGAN community
not in the paper's declared repositories
1 ran · 0 no recorded run
lupalab/posterior-matching community
Papers with Code archive
0 ran · 4 no recorded run
StanislavParovoy/VQ-VAE-WaveNet community
Papers with Code archive
0 ran · 1 no recorded run
hiwonjoon/tf-vqvae community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
Bitcodes Ran
ran on a synthesized input · constructed an object; no result was computed
archinetai/bitcodes-pytorch/bitcodes_pytorch/bitcodes.py
code served (permissive licence) · get_code("81037b2a5a5b548e")
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, Bitcodes: 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 torch import Tensor

torch.manual_seed(0)

ARGS = {
    "features": 8,
    "num_bits": 3,
    "temperature": 1
}
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 Bitcodes — 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 Bitcodes 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
Decoder Ran
ran on a synthesized input · constructed an object; no result was computed
MishaLaskin/vq-vae/models/vqvae.py
pointer only (licence: NONE) · get_code("7ec86ce9f1243c09")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, MishaLaskin/vq-vae when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Decoder Ran
ran on a synthesized input · constructed an object; no result was computed
ks2labs/modules/models/vqvae/model.py
code served (permissive licence) · get_code("9cef9b557ff5124b")
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, Decoder: 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 collections import OrderedDict

torch.manual_seed(0)

# Define the ARGS dictionary with all required parameters for Decoder
ARGS = {
    'in_dim': 4,
    'hidden_dim': 8,
    'n_residual_layers': 2,
    'hidden_dim_residual': 6
}
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 Decoder — 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 Decoder 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
Decoder Ran
ran on a synthesized input · constructed an object; no result was computed
andrecianflone/vector_quantization/vqvae.py
pointer only (licence: NONE) · get_code("4c2e3405d250cb33")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, andrecianflone/vector_quantization when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Decoder Ran
ran on a synthesized input · constructed an object; no result was computed
explainingai-code/VQVAE-Pytorch/model/vqvae.py
pointer only (licence: NONE) · get_code("e11e4311fbf78fb4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, explainingai-code/VQVAE-Pytorch when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Decoder Ran
ran on a synthesized input
airalcorn2/vqvae-pytorch/vqvae.py
code served (permissive licence) · get_code("6cff5e6be156f653")
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, 3, 40, 56) 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 ResidualStack(nn.Module):

    def __init__(self, num_hiddens, num_residual_layers, num_residual_hiddens):
        super().__init__()
        layers = []
        for i in range(num_residual_layers):
            layers.append(nn.Sequential(nn.ReLU(), nn.Conv2d(in_channels=num_hiddens, out_channels=num_residual_hiddens, kernel_size=3, padding=1), nn.ReLU(), nn.Conv2d(in_channels=num_residual_hiddens, out_channels=num_hiddens, kernel_size=1)))
        self.layers = nn.ModuleList(layers)

    def forward(self, x):
        h = x
        for layer in self.layers:
            h = h + layer(h)
        return torch.relu(h)

class Decoder(nn.Module):

    def __init__(self, embedding_dim, num_hiddens, num_upsampling_layers, num_residual_layers, num_residual_hiddens):
        super().__init__()
        self.conv = nn.Conv2d(in_channels=embedding_dim, out_channels=num_hiddens, kernel_size=3, padding=1)
        self.residual_stack = ResidualStack(num_hiddens, num_residual_layers, num_residual_hiddens)
        upconv = nn.Sequential()
        for upsampling_layer in range(num_upsampling_layers):
            if upsampling_layer < num_upsampling_layers - 2:
                in_channels, out_channels = (num_hiddens, num_hiddens)
            elif upsampling_layer == num_upsampling_layers - 2:
                in_channels, out_channels = (num_hiddens, num_hiddens // 2)
            else:
                in_channels, out_channels = (num_hiddens // 2, 3)
            upconv.add_module(f'up{upsampling_layer}', nn.ConvTranspose2d(in_channels=in_channels, out_channels=out_channels, kernel_size=4, stride=2, padding=1))
            if upsampling_layer < num_upsampling_layers - 1:
                upconv.add_module(f'relu{upsampling_layer}', nn.ReLU())
        self.upconv = upconv

    def forward(self, x):
        h = self.conv(x)
        h = self.residual_stack(h)
        x_recon = self.upconv(h)
        return x_recon


INIT_ARGS = {
    'embedding_dim': 4,
    'num_hiddens': 8,
    'num_upsampling_layers': 3,
    'num_residual_layers': 2,
    'num_residual_hiddens': 6,
}

ARGS = {
    'x': torch.randn(2, 4, 5, 7),
}
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, 3, 40, 56) — shape (2, 3, 40, 56) 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)
Decoder Ran
ran on a synthesized input
joh-fischer/PlantLDM/model/vqvae/vqvae.py
code served (permissive licence) · get_code("29d1b1a70747fecf")
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, 3, 32, 32) 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

class ResidualLayer(nn.Module):

    def __init__(self, in_channels: int, out_channels: int, hidden_dim: int):
        """
        Residual layer as specified in https://arxiv.org/abs/1711.00937. The original
        layer order is ReLU, 3x3 conv, ReLU, 1x1 conv (paper p. 5) with all having
        256 hidden units.

        Args:
            in_channels (int): number of input channels
            out_channels (int): number of output channels
            hidden_dim (int): number of hidden units
        """
        super(ResidualLayer, self).__init__()
        self.conv3x3 = nn.Conv2d(in_channels, hidden_dim, kernel_size=3, padding=1, stride=1, bias=False)
        self.conv1x1 = nn.Conv2d(hidden_dim, out_channels, kernel_size=1, padding=0, stride=1, bias=False)
        self.activation = nn.ReLU(True)

    def forward(self, x):
        identity = x
        x = self.activation(x)
        x = self.conv3x3(x)
        x = self.activation(x)
        x = self.conv1x1(x)
        x += identity
        return x

class Decoder(nn.Module):

    def __init__(self, latent_dim: int, out_channels: int, n_res_layers: int=2, res_hidden_dim: int=256):
        """
        Decoder for VQ-VAE like specified in https://arxiv.org/abs/1711.00937. According to the paper
        'decoder has two residual 3 × 3 blocks, followed by two transposed convolutions with stride
        2 and window size 4 × 4' (paper p. 5).

        Args:
            latent_dim (int): Dimension of the latent space
            out_channels (int): Number of output channels
            n_res_layers (int): Number of residual layers (paper and default: 2)
            res_hidden_dim (int): Hidden dimension of residual blocks (paper and default: 256)
        """
        super(Decoder, self).__init__()
        kernel = 4
        stride = 2
        self.res_stack = nn.ModuleList([ResidualLayer(latent_dim, latent_dim, res_hidden_dim) for _ in range(n_res_layers)])
        if latent_dim // 2 < 2:
            hidden_channels = 2
        else:
            hidden_channels = latent_dim // 2
        self.conv1 = nn.ConvTranspose2d(latent_dim, hidden_channels, kernel_size=kernel, stride=stride, padding=1)
        self.conv2 = nn.ConvTranspose2d(hidden_channels, out_channels, kernel_size=kernel, stride=stride, padding=1)
        self.activation = nn.ReLU()

    def forward(self, x):
        for layer in self.res_stack:
            x = layer(x)
        x = self.activation(x)
        x = self.conv1(x)
        x = self.activation(x)
        x = self.conv2(x)
        x = torch.tanh(x)
        return x


INIT_ARGS = {
    'latent_dim': 4,
    'out_channels': 3,
    'n_res_layers': 2,
    'res_hidden_dim': 8,
}

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

if __name__ == '__main__':
    decoder = Decoder(**INIT_ARGS)
    output = decoder(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print(f"Output range: [{output.min():.4f}, {output.max():.4f}]")
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, 3, 32, 32) — shape (2, 3, 32, 32) 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)
Decoder Ran
ran on a synthesized input
sisl/MultiAgentVariationalOcclusionInference/src/driver_sensor_model/models_cvae.py
code served (permissive licence) · get_code("5aeaa611b1aa19e0")
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, 1, 8, 12) 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 math

class ResBlock(nn.Module):

    def __init__(self, dim):
        super().__init__()
        self.block = nn.Sequential(nn.ReLU(False), nn.Conv2d(dim, dim, 3, 1, 1), nn.BatchNorm2d(dim), nn.ReLU(False), nn.Conv2d(dim, dim, 1), nn.BatchNorm2d(dim))

    def forward(self, x):
        return x + self.block(x)

class Decoder(nn.Module):

    def __init__(self, latent_size, label_size, dim):
        super().__init__()
        self.latent_size = latent_size
        self.dim = dim
        input_dim = 1
        self.decode_linear = nn.Sequential(nn.Linear(self.latent_size, self.latent_size * dim), nn.ReLU(False), nn.Linear(self.latent_size * dim, self.latent_size * dim), nn.ReLU(False))
        self.VQVAEBlock = nn.Sequential(ResBlock(dim), ResBlock(dim), nn.ReLU(False), nn.ConvTranspose2d(dim, dim, (4, 5), (2, 3), 1), nn.BatchNorm2d(dim), nn.ReLU(False), nn.ConvTranspose2d(dim, input_dim, 1, 1, 0), nn.Sigmoid())

    def forward(self, z):
        latent_size_sqrt = int(math.sqrt(self.latent_size))
        z_c = self.decode_linear(z)
        z_c = z_c.view(-1, self.dim, latent_size_sqrt, latent_size_sqrt)
        x = self.VQVAEBlock(z_c)
        return x

INIT_ARGS = {
    'latent_size': 16,
    'label_size': 10,
    'dim': 4
}

ARGS = {
    'z': torch.randn(2, 16)
}

if __name__ == '__main__':
    decoder = Decoder(**INIT_ARGS)
    output = decoder(**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
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, 1, 8, 12) — shape (2, 1, 8, 12) 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)
Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
MishaLaskin/vq-vae/models/vqvae.py
pointer only (licence: NONE) · get_code("37323902f8998883")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, MishaLaskin/vq-vae when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
ks2labs/modules/models/vqvae/model.py
code served (permissive licence) · get_code("5dc946b372865ded")
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, Encoder: 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 collections import OrderedDict

torch.manual_seed(0)

ARGS = {
    'in_dim': 3,
    'hidden_dim': 8,
    'n_residual_layers': 2,
    'hidden_dim_residual': 4
}

# Verify the Encoder can be instantiated and called with a small input tensor
encoder = nn.Sequential(OrderedDict([('conv_1', nn.Conv2d(ARGS['in_dim'], ARGS['hidden_dim'] // 2, 4, 2, padding=1)), ('relu_1', nn.ReLU()), ('conv_2', nn.Conv2d(ARGS['hidden_dim'] // 2, ARGS['hidden_dim'], 4, 2, padding=1)), ('relu_2', nn.ReLU()), ('conv_3', nn.Conv2d(ARGS['hidden_dim'], ARGS['hidden_dim'], 3, 1, padding=1))]))

# Test with a small input tensor (batch=2, channels=3, height=16, width=16)
test_input = torch.randn(2, ARGS['in_dim'], 16, 16)
test_output = encoder(test_input)
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 Encoder — 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 Encoder 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
Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
wayexists02/vqvae-pytorch-impl/models/vqvae.py
pointer only (licence: NONE) · get_code("33fe2331161629b0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wayexists02/vqvae-pytorch-impl when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
andrecianflone/vector_quantization/vqvae.py
pointer only (licence: NONE) · get_code("b371a7a9f919c844")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, andrecianflone/vector_quantization when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
explainingai-code/VQVAE-Pytorch/model/vqvae.py
pointer only (licence: NONE) · get_code("cbc53e73ec7ded92")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, explainingai-code/VQVAE-Pytorch when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
unixpickle/vq-draw/vq_draw/encoder.py
pointer only (licence: NONE) · get_code("2e0e8c659d27a232")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, unixpickle/vq-draw when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Encoder Ran
ran on a synthesized input
airalcorn2/vqvae-pytorch/vqvae.py
code served (permissive licence) · get_code("31f17da0e35924e8")
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, 8, 4, 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 torch import nn

class ResidualStack(nn.Module):

    def __init__(self, num_hiddens, num_residual_layers, num_residual_hiddens):
        super().__init__()
        layers = []
        for i in range(num_residual_layers):
            layers.append(nn.Sequential(nn.ReLU(), nn.Conv2d(in_channels=num_hiddens, out_channels=num_residual_hiddens, kernel_size=3, padding=1), nn.ReLU(), nn.Conv2d(in_channels=num_residual_hiddens, out_channels=num_hiddens, kernel_size=1)))
        self.layers = nn.ModuleList(layers)

    def forward(self, x):
        h = x
        for layer in self.layers:
            h = h + layer(h)
        return torch.relu(h)

class Encoder(nn.Module):

    def __init__(self, in_channels, num_hiddens, num_downsampling_layers, num_residual_layers, num_residual_hiddens):
        super().__init__()
        conv = nn.Sequential()
        for downsampling_layer in range(num_downsampling_layers):
            if downsampling_layer == 0:
                out_channels = num_hiddens // 2
            elif downsampling_layer == 1:
                in_channels, out_channels = (num_hiddens // 2, num_hiddens)
            else:
                in_channels, out_channels = (num_hiddens, num_hiddens)
            conv.add_module(f'down{downsampling_layer}', nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=4, stride=2, padding=1))
            conv.add_module(f'relu{downsampling_layer}', nn.ReLU())
        conv.add_module('final_conv', nn.Conv2d(in_channels=num_hiddens, out_channels=num_hiddens, kernel_size=3, padding=1))
        self.conv = conv
        self.residual_stack = ResidualStack(num_hiddens, num_residual_layers, num_residual_hiddens)

    def forward(self, x):
        h = self.conv(x)
        return self.residual_stack(h)


INIT_ARGS = {
    'in_channels': 3,
    'num_hiddens': 8,
    'num_downsampling_layers': 2,
    'num_residual_layers': 2,
    'num_residual_hiddens': 4,
}

ARGS = {
    'x': torch.randn(2, 3, 16, 16),
}
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, 8, 4, 4) — shape (2, 8, 4, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
Encoder Ran
ran on a synthesized input
joh-fischer/PlantLDM/model/vqvae/vqvae.py
code served (permissive licence) · get_code("b7ef8e42168ed9bc")
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, 8, 4, 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

# Encoder class definition
class ResidualLayer(nn.Module):

    def __init__(self, in_channels: int, out_channels: int, hidden_dim: int):
        super(ResidualLayer, self).__init__()
        self.conv3x3 = nn.Conv2d(in_channels, hidden_dim, kernel_size=3, padding=1, stride=1, bias=False)
        self.conv1x1 = nn.Conv2d(hidden_dim, out_channels, kernel_size=1, padding=0, stride=1, bias=False)
        self.activation = nn.ReLU(True)

    def forward(self, x):
        identity = x
        x = self.activation(x)
        x = self.conv3x3(x)
        x = self.activation(x)
        x = self.conv1x1(x)
        x += identity
        return x

class Encoder(nn.Module):

    def __init__(self, in_channels: int, latent_dim: int, n_res_layers: int=2, res_hidden_dim: int=256):
        super(Encoder, self).__init__()
        kernel = 4
        stride = 2
        if latent_dim // 2 < 2:
            hidden_channels = 2
        else:
            hidden_channels = latent_dim // 2
        self.conv1 = nn.Conv2d(in_channels, hidden_channels, kernel_size=kernel, stride=stride, padding=1)
        self.conv2 = nn.Conv2d(hidden_channels, latent_dim, kernel_size=kernel, stride=stride, padding=1)
        self.res_stack = nn.ModuleList([ResidualLayer(latent_dim, latent_dim, res_hidden_dim) for _ in range(n_res_layers)])
        self.activation = nn.ReLU()

    def forward(self, x):
        x = self.conv1(x)
        x = self.activation(x)
        x = self.conv2(x)
        for layer in self.res_stack:
            x = layer(x)
        x = self.activation(x)
        return x

# Setup code
INIT_ARGS = {
    'in_channels': 3,
    'latent_dim': 8,
    'n_res_layers': 2,
    'res_hidden_dim': 64
}

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

# Construct and call
encoder = Encoder(**INIT_ARGS)
output = encoder(**ARGS)
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, 8, 4, 4) — shape (2, 8, 4, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
NearestEmbed Ran
ran on a synthesized input
nadavbh12/VQ-VAE/vq_vae/auto_encoder.py
code served (permissive licence) · get_code("4db13c56150e213c")
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. 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
import numpy as np
from torch.autograd import Function, Variable

class NearestEmbedFunc(Function):
    """
    Input:
    ------
    x - (batch_size, emb_dim, *)
        Last dimensions may be arbitrary
    emb - (emb_dim, num_emb)
    """

    @staticmethod
    def forward(ctx, input, emb):
        if input.size(1) != emb.size(0):
            raise RuntimeError('invalid argument: input.size(1) ({}) must be equal to emb.size(0) ({})'.format(input.size(1), emb.size(0)))
        ctx.batch_size = input.size(0)
        ctx.num_latents = int(np.prod(np.array(input.size()[2:])))
        ctx.emb_dim = emb.size(0)
        ctx.num_emb = emb.size(1)
        ctx.input_type = type(input)
        ctx.dims = list(range(len(input.size())))
        x_expanded = input.unsqueeze(-1)
        num_arbitrary_dims = len(ctx.dims) - 2
        if num_arbitrary_dims:
            emb_expanded = emb.view(emb.shape[0], *[1] * num_arbitrary_dims, emb.shape[1])
        else:
            emb_expanded = emb
        dist = torch.norm(x_expanded - emb_expanded, 2, 1)
        _, argmin = dist.min(-1)
        shifted_shape = [input.shape[0], *list(input.shape[2:]), input.shape[1]]
        result = emb.t().index_select(0, argmin.view(-1)).view(shifted_shape).permute(0, ctx.dims[-1], *ctx.dims[1:-1])
        ctx.save_for_backward(argmin)
        return (result.contiguous(), argmin)

    @staticmethod
    def backward(ctx, grad_output, argmin=None):
        grad_input = grad_emb = None
        if ctx.needs_input_grad[0]:
            grad_input = grad_output
        if ctx.needs_input_grad[1]:
            argmin, = ctx.saved_tensors
            latent_indices = torch.arange(ctx.num_emb).type_as(argmin)
            idx_choices = (argmin.view(-1, 1) == latent_indices.view(1, -1)).type_as(grad_output.data)
            n_idx_choice = idx_choices.sum(0)
            n_idx_choice[n_idx_choice == 0] = 1
            idx_avg_choices = idx_choices / n_idx_choice
            grad_output = grad_output.permute(0, *ctx.dims[2:], 1).contiguous()
            grad_output = grad_output.view(ctx.batch_size * ctx.num_latents, ctx.emb_dim)
            grad_emb = torch.sum(grad_output.data.view(-1, ctx.emb_dim, 1) * idx_avg_choices.view(-1, 1, ctx.num_emb), 0)
        return (grad_input, grad_emb, None, None)

def nearest_embed(x, emb):
    return NearestEmbedFunc.apply(x, emb)

class NearestEmbed(nn.Module):

    def __init__(self, num_embeddings, embeddings_dim):
        super(NearestEmbed, self).__init__()
        self.weight = nn.Parameter(torch.rand(embeddings_dim, num_embeddings))

    def forward(self, x, weight_sg=False):
        """Input:
        ---------
        x - (batch_size, emb_size, *)
        """
        return nearest_embed(x, self.weight.detach() if weight_sg else self.weight)


INIT_ARGS = {
    'num_embeddings': 5,
    'embeddings_dim': 4,
}

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

if __name__ == '__main__':
    model = NearestEmbed(**INIT_ARGS)
    output = model(**ARGS)
    print("Output:", output)
    print("Output[0] shape:", output[0].shape)
    print("Output[1] shape:", output[1].shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
NearestEmbedFunc Ran
ran on a synthesized input · constructed an object; no result was computed
nadavbh12/VQ-VAE/vq_vae/auto_encoder.py
code served (permissive licence) · get_code("56b746f89213fdc4")
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, NearestEmbedFunc: 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 numpy as np

torch.manual_seed(0)

# The function expects:
# - input: (batch_size, emb_dim, *)  where * can be arbitrary spatial dims
# - emb: (emb_dim, num_emb)

# Create a simple input tensor
# batch_size=2, emb_dim=4, spatial dims: 3x5
batch_size = 2
emb_dim = 4
input_tensor = torch.randn(batch_size, emb_dim, 3, 5)

# Create embedding tensor
# emb_dim=4, num_emb=6
num_emb = 6
emb_tensor = torch.randn(emb_dim, num_emb)

ARGS = {
    'input': input_tensor,
    'emb': emb_tensor,
}
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 NearestEmbedFunc — 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 NearestEmbedFunc 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
Quantize Ran
ran on a synthesized input · constructed an object; no result was computed
andrecianflone/vector_quantization/vqvae.py
pointer only (licence: NONE) · get_code("11e9c619687afa02")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, andrecianflone/vector_quantization when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Quantizer Ran
ran on a synthesized input · constructed an object; no result was computed
explainingai-code/VQVAE-Pytorch/model/vqvae.py
pointer only (licence: NONE) · get_code("61f7701b94565897")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, explainingai-code/VQVAE-Pytorch when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Quantizing Ran
ran on a synthesized input · constructed an object; no result was computed
Geson-anko/VQ_AutoEncoder/quantizing_layers.py
code served (permissive licence) · get_code("2332d2c1ae59a613")
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, Quantizing: 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)

# Small example tensors and values for the Quantizing layer
num_quantizing = 5
quantizing_dim = 4

# Create a small weight tensor to test with
_weight = torch.randn(num_quantizing, quantizing_dim)

# Define ARGS dict with all parameters
ARGS = {
    'num_quantizing': num_quantizing,
    'quantizing_dim': quantizing_dim,
    '_weight': _weight,
    'initialize_by_dataset': False,
    'mean': 0.0,
    'std': 1.0,
    'dtype': torch.float32,
    'device': torch.device('cpu'),
}
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 Quantizing — 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 Quantizing 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
ResBlock Ran
ran on a synthesized input · constructed an object; no result was computed
wayexists02/vqvae-pytorch-impl/models/vqvae.py
pointer only (licence: NONE) · get_code("d14328d52ad612df")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wayexists02/vqvae-pytorch-impl when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ResBlock Ran
ran on a synthesized input · constructed an object; no result was computed
andrecianflone/vector_quantization/vqvae.py
pointer only (licence: NONE) · get_code("e208e656b3429e2c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, andrecianflone/vector_quantization when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ResBlock Ran
ran on a synthesized input
sisl/MultiAgentVariationalOcclusionInference/src/driver_sensor_model/models_cvae.py
code served (permissive licence) · get_code("a7d565fc7647b7f9")
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
import torch.nn as nn

INIT_ARGS = {
    'dim': 4
}

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

if __name__ == '__main__':
    model = nn.Module()
    
    class ResBlock(nn.Module):
        def __init__(self, dim):
            super().__init__()
            self.block = nn.Sequential(
                nn.ReLU(False),
                nn.Conv2d(dim, dim, 3, 1, 1),
                nn.BatchNorm2d(dim),
                nn.ReLU(False),
                nn.Conv2d(dim, dim, 1),
                nn.BatchNorm2d(dim)
            )

        def forward(self, x):
            return x + self.block(x)
    
    resblock = ResBlock(**INIT_ARGS)
    output = resblock(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Expected shape: {ARGS['x'].shape}")
    assert output.shape == ARGS['x'].shape, "Shape mismatch!"
    print("Success!")
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)
ResTransposeBlock Ran
ran on a synthesized input · constructed an object; no result was computed
wayexists02/vqvae-pytorch-impl/models/vqvae.py
pointer only (licence: NONE) · get_code("dc26380ed75e55c0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wayexists02/vqvae-pytorch-impl when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Residual Ran
ran on a synthesized input · constructed an object; no result was computed
ks2labs/modules/models/vqvae/model.py
code served (permissive licence) · get_code("230f3bafb927fa9b")
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, Residual: 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_dim': 3,
    'out_dim': 4,
    'hidden_dim': 5,
}
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 Residual — 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 Residual 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
ResidualLayer Ran
ran on a synthesized input
joh-fischer/PlantLDM/model/vqvae/vqvae.py
code served (permissive licence) · get_code("c92e0eaec11f87ef")
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; 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 ResidualLayer.__init__
INIT_ARGS = {
    'in_channels': 8,
    'out_channels': 8,
    'hidden_dim': 12
}

# ARGS: parameters for ResidualLayer.forward
# The forward method expects x with shape (batch, in_channels, height, width)
# in_channels must match INIT_ARGS['in_channels'] and out_channels must match INIT_ARGS['out_channels']
# for the residual connection to work (identity = x, then x += identity)
ARGS = {
    'x': torch.randn(2, 8, 16, 16)
}
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 — 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)
ResidualStack Ran
ran on a synthesized input · constructed an object; no result was computed
MishaLaskin/vq-vae/models/vqvae.py
pointer only (licence: NONE) · get_code("717b778f8ecfc744")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, MishaLaskin/vq-vae when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ResidualStack Ran
ran on a synthesized input · constructed an object; no result was computed
ks2labs/modules/models/vqvae/model.py
code served (permissive licence) · get_code("2826483ff96d8731")
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, ResidualStack: 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 collections import OrderedDict

torch.manual_seed(0)

ARGS = {
    'in_dim': 4,
    'out_dim': 5,
    'n_residual_layers': 3,
    'hidden_dim': 6
}
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 ResidualStack — 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 ResidualStack 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
ResidualStack Ran
ran on a synthesized input
airalcorn2/vqvae-pytorch/vqvae.py
code served (permissive licence) · get_code("9a0e3f52b1b95012")
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, 8, 3, 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

class ResidualStack(nn.Module):

    def __init__(self, num_hiddens, num_residual_layers, num_residual_hiddens):
        super().__init__()
        layers = []
        for i in range(num_residual_layers):
            layers.append(nn.Sequential(nn.ReLU(), nn.Conv2d(in_channels=num_hiddens, out_channels=num_residual_hiddens, kernel_size=3, padding=1), nn.ReLU(), nn.Conv2d(in_channels=num_residual_hiddens, out_channels=num_hiddens, kernel_size=1)))
        self.layers = nn.ModuleList(layers)

    def forward(self, x):
        h = x
        for layer in self.layers:
            h = h + layer(h)
        return torch.relu(h)


INIT_ARGS = {
    'num_hiddens': 8,
    'num_residual_layers': 2,
    'num_residual_hiddens': 4,
}

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

if __name__ == '__main__':
    model = ResidualStack(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output: {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, 8, 3, 3) — shape (2, 8, 3, 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)
SonnetExponentialMovingAverage Ran
ran on a synthesized input
airalcorn2/vqvae-pytorch/vqvae.py
code served (permissive licence) · get_code("a7bbba1a7d675924")
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 2, 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 numpy as np

# INIT_ARGS: decay and shape
INIT_ARGS = {
    'decay': 0.99,
    'shape': (3, 4)  # 2D shape: 3x4
}

# ARGS: value parameter for __call__ (which calls update)
ARGS = {
    'value': torch.randn(3, 4)  # Must match the shape from INIT_ARGS
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
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 — 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)
VQEmbeddingEMA Ran
ran on a synthesized input · constructed an object; no result was computed
bshall/VectorQuantizedCPC/model.py
code served (permissive licence) · get_code("a9d07171b60f51f8")
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, VQEmbeddingEMA: 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)

# VQEmbeddingEMA expects:
# - n_embeddings: int (number of embedding vectors)
# - embedding_dim: int (dimension of each embedding)
# - commitment_cost: float (default 0.25)
# - decay: float (default 0.999)
# - epsilon: float (default 1e-05)

ARGS = {
    'n_embeddings': 8,
    'embedding_dim': 4,
    'commitment_cost': 0.25,
    'decay': 0.999,
    'epsilon': 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 VQEmbeddingEMA — 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 VQEmbeddingEMA 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
VQEmbeddingEMA Ran
ran on a synthesized input · constructed an object; no result was computed
bshall/ZeroSpeech/model.py
pointer only (licence: NONE) · get_code("b5071cb976519bd8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, bshall/ZeroSpeech when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

VQVAE Ran
ran on a synthesized input · constructed an object; no result was computed
sarus-tech/tf2-published-models/vqvae/model.py
code served (permissive licence) · get_code("a9ecf52cfae83fc0")
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, VQVAE: 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 tensorflow as tf
import numpy as np

tfk = tf.keras
tfkl = tfk.layers

# Create a simple encoder model
def create_encoder(embedding_dim=4):
    """Create a simple encoder that outputs embeddings."""
    model = tfk.Sequential([
        tfkl.Input(shape=(8, 8, 3)),
        tfkl.Conv2D(16, 3, padding='same', activation='relu'),
        tfkl.Conv2D(embedding_dim, 3, padding='same')
    ])
    return model

# Create a simple decoder model
def create_decoder(embedding_dim=4):
    """Create a simple decoder that reconstructs images."""
    model = tfk.Sequential([
        tfkl.Input(shape=(8, 8, embedding_dim)),
        tfkl.Conv2D(16, 3, padding='same', activation='relu'),
        tfkl.Conv2D(3, 3, padding='same')
    ])
    return model

# Create encoder and decoder instances
encoder = create_encoder(embedding_dim=4)
decoder = create_decoder(embedding_dim=4)

# Define arguments for VQVAE
ARGS = {
    'encoder': encoder,
    'decoder': decoder,
    'codebook_size': 8,
    'beta': 0.25
}
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 VQVAE — 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 VQVAE 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
VQVAE Ran
ran on a synthesized input
ks2labs/modules/models/vqvae/model.py
code served (permissive licence) · get_code("49e082f17ee0f50c")
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. 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 numpy as np
from collections import OrderedDict
from torch import nn
from torch.nn import functional as F

INIT_ARGS = {
    'hidden_dim': 4,
    'n_residual_layers': 2,
    'hidden_dim_residual': 3,
    'vocab_size': 8,
    'beta': 0.25
}

# Create input tensor: batch_size=2, channels=3, height=4, width=4
input_tensor = torch.randn(2, 3, 4, 4)

ARGS = {
    'x': input_tensor
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
VQVAE Ran
ran on a synthesized input · constructed an object; no result was computed
explainingai-code/VQVAE-Pytorch/model/vqvae.py
pointer only (licence: NONE) · get_code("cae2955852764a22")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, explainingai-code/VQVAE-Pytorch when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

VQVAE Ran
ran on a synthesized input
joh-fischer/PlantLDM/model/vqvae/vqvae.py
code served (permissive licence) · get_code("d26761dae4136be0")
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. 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 einops

class ResidualLayer(nn.Module):
    def __init__(self, in_channels: int, out_channels: int, hidden_dim: int):
        super(ResidualLayer, self).__init__()
        self.conv3x3 = nn.Conv2d(in_channels, hidden_dim, kernel_size=3, padding=1, stride=1, bias=False)
        self.conv1x1 = nn.Conv2d(hidden_dim, out_channels, kernel_size=1, padding=0, stride=1, bias=False)
        self.activation = nn.ReLU(True)

    def forward(self, x):
        identity = x
        x = self.activation(x)
        x = self.conv3x3(x)
        x = self.activation(x)
        x = self.conv1x1(x)
        x += identity
        return x

class Decoder(nn.Module):
    def __init__(self, latent_dim: int, out_channels: int, n_res_layers: int=2, res_hidden_dim: int=256):
        super(Decoder, self).__init__()
        kernel = 4
        stride = 2
        self.res_stack = nn.ModuleList([ResidualLayer(latent_dim, latent_dim, res_hidden_dim) for _ in range(n_res_layers)])
        if latent_dim // 2 < 2:
            hidden_channels = 2
        else:
            hidden_channels = latent_dim // 2
        self.conv1 = nn.ConvTranspose2d(latent_dim, hidden_channels, kernel_size=kernel, stride=stride, padding=1)
        self.conv2 = nn.ConvTranspose2d(hidden_channels, out_channels, kernel_size=kernel, stride=stride, padding=1)
        self.activation = nn.ReLU()

    def forward(self, x):
        for layer in self.res_stack:
            x = layer(x)
        x = self.activation(x)
        x = self.conv1(x)
        x = self.activation(x)
        x = self.conv2(x)
        x = torch.tanh(x)
        return x

class Encoder(nn.Module):
    def __init__(self, in_channels: int, latent_dim: int, n_res_layers: int=2, res_hidden_dim: int=256):
        super(Encoder, self).__init__()
        kernel = 4
        stride = 2
        if latent_dim // 2 < 2:
            hidden_channels = 2
        else:
            hidden_channels = latent_dim // 2
        self.conv1 = nn.Conv2d(in_channels, hidden_channels, kernel_size=kernel, stride=stride, padding=1)
        self.conv2 = nn.Conv2d(hidden_channels, latent_dim, kernel_size=kernel, stride=stride, padding=1)
        self.res_stack = nn.ModuleList([ResidualLayer(latent_dim, latent_dim, res_hidden_dim) for _ in range(n_res_layers)])
        self.activation = nn.ReLU()

    def forward(self, x):
        x = self.conv1(x)
        x = self.activation(x)
        x = self.conv2(x)
        for layer in self.res_stack:
            x = layer(x)
        x = self.activation(x)
        return x

class VectorQuantizer(nn.Module):
    def __init__(self, n_embeddings: int, latent_dim: int):
        super(VectorQuantizer, self).__init__()
        self.n_emb = n_embeddings
        self.latent_dim = latent_dim
        self.embedding = nn.Embedding(self.n_emb, self.latent_dim)
        self.embedding.weight.data.uniform_(-1.0 / self.latent_dim, 1.0 / self.latent_dim)

    def forward(self, z: torch.Tensor):
        z_flat = einops.rearrange(z, 'b c h w -> (b h w) c')
        distances = torch.cdist(z_flat, self.embedding.weight)
        indices = torch.argmin(distances, dim=1)
        z_q = self.embedding(indices)
        z_q = einops.rearrange(z_q, '(b h w) c -> b c h w', b=z.shape[0], h=z.shape[2], w=z.shape[3])
        return z_q, indices

class VQVAE(nn.Module):
    def __init__(self, in_channels: int, latent_dim: int, n_embeddings: int, n_res_layers: int=2, res_hidden_dim: int=256):
        super(VQVAE, self).__init__()
        self.encoder = Encoder(in_channels, latent_dim, n_res_layers, res_hidden_dim)
        self.quantizer = VectorQuantizer(n_embeddings, latent_dim)
        self.decoder = Decoder(latent_dim, in_channels, n_res_layers, res_hidden_dim)

    def forward(self, x):
        z = self.encoder(x)
        z_q, indices = self.quantizer(z)
        x_recon = self.decoder(z_q)
        return x_recon, z, z_q, indices

INIT_ARGS = {
    'in_channels': 3,
    'latent_dim': 8,
    'n_embeddings': 16,
    'n_res_layers': 2,
    'res_hidden_dim': 64
}

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

if __name__ == '__main__':
    model = VQVAE(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Reconstruction shape: {output[0].shape}")
    print(f"Latent shape: {output[1].shape}")
    print(f"Quantized latent shape: {output[2].shape}")
    print(f"Indices shape: {output[3].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 — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
VQVAELayer Ran
ran on a synthesized input · constructed an object; no result was computed
nicolaffETHZ/Brain2Word_paper/models.py
pointer only (licence: NONE) · get_code("18395ffd69df1890")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, nicolaffETHZ/Brain2Word_paper when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

VQ_VAE Ran
ran on a synthesized input · constructed an object; no result was computed
nadavbh12/VQ-VAE/vq_vae/auto_encoder.py
code served (permissive licence) · get_code("811d0edff7823e5b")
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, VQ_VAE: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 = {
    'hidden': 8,
    'k': 4,
    'vq_coef': 0.2,
    'comit_coef': 0.4,
}
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 VQ_VAE — 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 VQ_VAE 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
VectorQuant Ran
ran on a synthesized input · constructed an object; no result was computed
rhoposit/icassp2021/layers/vector_quant.py
code served (permissive licence) · get_code("4926226bc5727d02")
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, VectorQuant: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 math

torch.manual_seed(0)

class VectorQuant(nn.Module):
    """
        Input: (N, samples, n_channels, vec_len) numeric tensor
        Output: (N, samples, n_channels, vec_len) numeric tensor
    """

    def __init__(self, n_channels, n_classes, vec_len, normalize=False):
        super().__init__()
        if normalize:
            target_scale = 0.06
            self.embedding_scale = target_scale
            self.normalize_scale = target_scale
        else:
            self.embedding_scale = 0.001
            self.normalize_scale = None
        self.embedding0 = nn.Parameter(torch.randn(n_channels, n_classes, vec_len, requires_grad=True) * self.embedding_scale)
        self.offset = torch.arange(n_channels) * n_classes
        self.n_classes = n_classes
        self.after_update()

    def forward(self, x0):
        if self.normalize_scale:
            target_norm = self.normalize_scale * math.sqrt(x0.size(3))
            x = target_norm * x0 / x0.norm(dim=3, keepdim=True)
            embedding = target_norm * self.embedding0 / self.embedding0.norm(dim=2, keepdim=True)
        else:
            x = x0
            embedding = self.embedding0
        x1 = x.reshape(x.size(0) * x.size(1), x.size(2), 1, x.size(3))
        index_chunks = []
        for x1_chunk in x1.split(512, dim=0):
            index_chunks.append((x1_chunk - embedding).norm(dim=3).argmin(dim=2))
        index = torch.cat(index_chunks, dim=0)
        if True:
            hist = index.float().cpu().histc(bins=self.n_classes, min=-0.5, max=self.n_classes - 0.5)
            prob = hist.masked_select(hist > 0) / len(index)
            entropy = -(prob * prob.log()).sum().item()
        else:
            entropy = 0
        view_item = index.size(0) * index.size(1)
        view_ref = index + self.offset
        index1 = view_ref.view(view_item)
        output_flat = embedding.view(-1, embedding.size(2)).index_select(dim=0, index=index1)
        output = output_flat.view(x.size())
        out0 = (output - x).detach() + x
        out1 = (x.detach() - output).float().norm(dim=3).pow(2)
        out2 = (x - output.detach()).float().norm(dim=3).pow(2) + (x - x0).float().norm(dim=3).pow(2)
        return (out0, out1, out2, entropy, hist)

    def after_update(self):
        if self.normalize_scale:
            with torch.no_grad():
                target_norm = self.embedding_scale * math.sqrt(self.embedding0.size(2))
                self.embedding0.mul_(target_norm / self.embedding0.norm(dim=2, keepdim=True))

n_channels = 3
n_classes = 4
vec_len = 5
normalize = False

ARGS = {
    'n_channels': n_channels,
    'n_classes': n_classes,
    'vec_len': vec_len,
    'normalize': normalize
}
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 VectorQuant — 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 VectorQuant 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
VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
swasun/VQ-VAE-Speech/src/models/vector_quantizer.py
code served (permissive licence) · get_code("76b559c1503ca76c")
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, VectorQuantizer: 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 the arguments for VectorQuantizer.__init__
ARGS = {
    'num_embeddings': 8,
    'embedding_dim': 4,
    'commitment_cost': 0.25,
    'device': 'cpu'
}
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 VectorQuantizer — 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 VectorQuantizer 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
VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
swasun/VQ-VAE-images/src/vector_quantizer.py
code served (permissive licence) · get_code("fbd6f2f3cc98b66f")
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, VectorQuantizer: 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)

# Set device to CPU
device = torch.device('cpu')

# Define parameters for VectorQuantizer
num_embeddings = 8
embedding_dim = 4
commitment_cost = 0.25

# Create a sample input tensor with shape [batch, channels, height, width]
# The forward method expects: inputs.permute(0, 2, 3, 1)
# So we create a tensor of shape [batch=2, channels=4, height=3, width=5]
inputs = torch.randn(2, 4, 3, 5)

ARGS = {
    'device': device,
    'num_embeddings': num_embeddings,
    'embedding_dim': embedding_dim,
    'commitment_cost': commitment_cost,
}
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 VectorQuantizer — 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 VectorQuantizer 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
VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
MishaLaskin/vq-vae/models/vqvae.py
pointer only (licence: NONE) · get_code("04236f77961d2db4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, MishaLaskin/vq-vae when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
ks2labs/modules/models/vqvae/model.py
code served (permissive licence) · get_code("42a9b84a1bbb0a02")
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, VectorQuantizer: 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)

# VectorQuantizer parameters
vocab_size = 8
hidden_dim = 4
beta = 0.25

ARGS = {
    "vocab_size": vocab_size,
    "hidden_dim": hidden_dim,
    "beta": beta,
}
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 VectorQuantizer — 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 VectorQuantizer 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
VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
buaavrcg/LEGaussians/preprocess/quantizer.py
code served (permissive licence) · get_code("9c64b505481dc36b")
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, VectorQuantizer: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 = {
    'n_e': 8,
    'e_dim': 4,
    'beta': 0.25,
    'device': torch.device('cpu'),
    'concat': False,
    'dino_weight': 0
}
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 VectorQuantizer — 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 VectorQuantizer 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
VectorQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
v-iashin/SpecVQGAN/specvqgan/modules/vqvae/quantize.py
code served (permissive licence) · get_code("bf13977cfc8d3cda")
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, VectorQuantizer: 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)

# Parameters for VectorQuantizer.__init__
n_e = 8  # number of embeddings
e_dim = 4  # embedding dimension
beta = 0.25  # commitment cost

ARGS = {
    "n_e": n_e,
    "e_dim": e_dim,
    "beta": beta,
}
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 VectorQuantizer — 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 VectorQuantizer 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
VectorQuantizer Ran
ran on a synthesized input
airalcorn2/vqvae-pytorch/vqvae.py
code served (permissive licence) · get_code("8b8f0e96d4c8976a")
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. 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
from torch.nn import functional as F

# Copy the classes from the problem statement
class SonnetExponentialMovingAverage(nn.Module):

    def __init__(self, decay, shape):
        super().__init__()
        self.decay = decay
        self.counter = 0
        self.register_buffer('hidden', torch.zeros(*shape))
        self.register_buffer('average', torch.zeros(*shape))

    def update(self, value):
        self.counter += 1
        with torch.no_grad():
            self.hidden -= (self.hidden - value) * (1 - self.decay)
            self.average = self.hidden / (1 - self.decay ** self.counter)

    def __call__(self, value):
        self.update(value)
        return self.average

class VectorQuantizer(nn.Module):

    def __init__(self, embedding_dim, num_embeddings, use_ema, decay, epsilon):
        super().__init__()
        self.embedding_dim = embedding_dim
        self.num_embeddings = num_embeddings
        self.use_ema = use_ema
        self.decay = decay
        self.epsilon = epsilon
        limit = 3 ** 0.5
        e_i_ts = torch.FloatTensor(embedding_dim, num_embeddings).uniform_(-limit, limit)
        if use_ema:
            self.register_buffer('e_i_ts', e_i_ts)
        else:
            self.register_parameter('e_i_ts', nn.Parameter(e_i_ts))
        self.N_i_ts = SonnetExponentialMovingAverage(decay, (num_embeddings,))
        self.m_i_ts = SonnetExponentialMovingAverage(decay, e_i_ts.shape)

    def forward(self, x):
        flat_x = x.permute(0, 2, 3, 1).reshape(-1, self.embedding_dim)
        distances = (flat_x ** 2).sum(1, keepdim=True) - 2 * flat_x @ self.e_i_ts + (self.e_i_ts ** 2).sum(0, keepdim=True)
        encoding_indices = distances.argmin(1)
        quantized_x = F.embedding(encoding_indices.view(x.shape[0], *x.shape[2:]), self.e_i_ts.transpose(0, 1)).permute(0, 3, 1, 2)
        if not self.use_ema:
            dictionary_loss = ((x.detach() - quantized_x) ** 2).mean()
        else:
            dictionary_loss = None
        commitment_loss = ((x - quantized_x.detach()) ** 2).mean()
        quantized_x = x + (quantized_x - x).detach()
        if self.use_ema and self.training:
            with torch.no_grad():
                encoding_one_hots = F.one_hot(encoding_indices, self.num_embeddings).type(flat_x.dtype)
                n_i_ts = encoding_one_hots.sum(0)
                self.N_i_ts(n_i_ts)
                embed_sums = flat_x.transpose(0, 1) @ encoding_one_hots
                self.m_i_ts(embed_sums)
                N_i_ts_sum = self.N_i_ts.average.sum()
                N_i_ts_stable = (self.N_i_ts.average + self.epsilon) / (N_i_ts_sum + self.num_embeddings * self.epsilon) * N_i_ts_sum
                self.e_i_ts = self.m_i_ts.average / N_i_ts_stable.unsqueeze(0)
        return (quantized_x, dictionary_loss, commitment_loss, encoding_indices.view(x.shape[0], -1))

# Setup arguments
INIT_ARGS = {
    'embedding_dim': 4,
    'num_embeddings': 8,
    'use_ema': False,
    'decay': 0.99,
    'epsilon': 1e-5,
}

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

# Construct and call
if __name__ == '__main__':
    model = VectorQuantizer(**INIT_ARGS)
    model.eval()
    output = model(**ARGS)
    print("Output shapes:")
    print(f"  quantized_x: {output[0].shape}")
    print(f"  dictionary_loss: {output[1]}")
    print(f"  commitment_loss: {output[2].shape}")
    print(f"  encoding_indices: {output[3].shape}")
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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
VectorQuantizer Ran
ran on a synthesized input
joh-fischer/PlantLDM/model/vqvae/vqvae.py
code served (permissive licence) · get_code("66c0ecce454f52da")
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
import torch.nn as nn
import einops

class VectorQuantizer(nn.Module):

    def __init__(self, n_embeddings: int, latent_dim: int):
        """
        Vector quantizer that discretizes the continuous latent z. Adapted from
        https://github.com/MishaLaskin/vqvae/blob/master/models/quantizer.py.
        Args:
            n_embeddings (int): Codebook size
            latent_dim (int): Dimension of the latent z (channels)
        """
        super(VectorQuantizer, self).__init__()
        self.n_emb = n_embeddings
        self.latent_dim = latent_dim
        self.embedding = nn.Embedding(self.n_emb, self.latent_dim)
        self.embedding.weight.data.uniform_(-1.0 / self.latent_dim, 1.0 / self.latent_dim)

    def forward(self, z: torch.Tensor):
        """
        Maps the output of the encoder network z (continuous) to a discrete one-hot
        vector z_q, where the index indicates the closest embedding vector e_j. The
        latent z is detached as first step to allow straight through backprop.
        Args:
            z: Output of the encoder network, shape [bs, latent_dim, h, w]
        Returns:
            z_q: Quantized z
        """
        bs, c, h, w = z.shape
        z_flat = einops.rearrange(z, 'b c h w -> (b h w) c')
        z_sq = torch.sum(z_flat ** 2, dim=1, keepdim=True)
        e_sq = torch.sum(self.embedding.weight ** 2, dim=1)
        e_z = torch.matmul(z_flat, self.embedding.weight.t())
        distances = z_sq + e_sq - 2 * e_z
        argmin_inds = torch.argmin(distances, dim=1)
        argmin_one_hot = nn.functional.one_hot(argmin_inds, num_classes=self.n_emb).float().to(z.device)
        z_q = torch.matmul(argmin_one_hot, self.embedding.weight)
        z_q = einops.rearrange(z_q, '(b h w) c -> b c h w', b=bs, h=h, w=w)
        return z_q


INIT_ARGS = {
    'n_embeddings': 8,
    'latent_dim': 4,
}

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

if __name__ == '__main__':
    vq = VectorQuantizer(**INIT_ARGS)
    output = vq(**ARGS)
    print(f"Input shape: {ARGS['z'].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
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 (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)
VectorQuantizerEMA Ran
ran on a synthesized input · constructed an object; no result was computed
sarus-tech/tf2-published-models/vqvae/model.py
code served (permissive licence) · get_code("63f246fab2a847d8")
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, VectorQuantizerEMA: 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 tensorflow as tf
import numpy as np

tf.random.set_seed(0)
np.random.seed(0)

# Create a small input tensor for testing
# Shape: (batch_size, height, width, embedding_dim)
batch_size = 2
embedding_dim = 4
height = 3
width = 3
codebook_size = 5

input_tensor = tf.random.normal((batch_size, height, width, embedding_dim), dtype=tf.float32)

ARGS = {
    'codebook_size': codebook_size,
    'decay': 0.9
}
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 VectorQuantizerEMA — 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 VectorQuantizerEMA 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
approx_qy_x Ran
ran; our contract draft was wrong, not the code
yjlolo/vae-audio/base/base_model.py
code served (permissive licence) · get_code("56dc0f7a70802e2c")
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, 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 numpy as np

torch.manual_seed(0)

# The function uses mu_lookup and logvar_lookup as callables that take an index
# and return tensors. We'll create simple lookup functions.

batch_size = 2
latent_dim = 4
n_component = 3

# Create sample latent variables z
z = torch.randn(batch_size, latent_dim)

# Create lookup functions for mu and logvar
# These should return tensors of shape (latent_dim,)
mu_values = torch.randn(n_component, latent_dim)
logvar_values = torch.randn(n_component, latent_dim)

def mu_lookup(k):
    return mu_values[k]

def logvar_lookup(k):
    return logvar_values[k]

ARGS = {
    "z": z,
    "mu_lookup": mu_lookup,
    "logvar_lookup": logvar_lookup,
    "n_component": n_component,
}
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 tuple, ndim 3, 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
fc Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
yjlolo/vae-audio/model/model.py
code served (permissive licence) · get_code("f2450ca8951604d7")
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
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'n_layer': 3,
    'n_channel': [4, 8, 6, 5],
    'activation': 'tanh',
    'batchNorm': True
}
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
get_decoder Ran
ran; our contract draft was wrong, not the code
explainingai-code/VQVAE-Pytorch/model/vqvae.py
pointer only (licence: NONE) · get_code("32ad87238c5e79f6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, explainingai-code/VQVAE-Pytorch when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_instance Ran
ran; our contract draft was wrong, not the code
yjlolo/vae-audio/dataset/audio_transform.py
code served (permissive licence) · get_code("d21115129d752c6b")
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 LinearLayer. 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)

# Create a minimal module with some example classes
class ExampleModule:
    class LinearLayer(nn.Module):
        def __init__(self, in_features=4, out_features=3):
            super().__init__()
            self.linear = nn.Linear(in_features, out_features)
        
        def forward(self, x):
            return self.linear(x)
    
    class ConvLayer(nn.Module):
        def __init__(self, in_channels=1, out_channels=2):
            super().__init__()
            self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3)
        
        def forward(self, x):
            return self.conv(x)

# Create module instance
module = ExampleModule

# Create config dict that specifies which type to instantiate and with what args
config = {
    'model': {
        'type': 'LinearLayer',
        'args': {
            'in_features': 4,
            'out_features': 3
        }
    },
    'encoder': {
        'type': 'ConvLayer'
    }
}

# Create arguments dict for get_instance function
ARGS = {
    'module': module,
    'name': 'model',
    'config': config
}
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 LinearLayer — a LinearLayer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LinearLayer 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_quantizer Ran
ran; our contract draft was wrong, not the code
explainingai-code/VQVAE-Pytorch/model/vqvae.py
pointer only (licence: NONE) · get_code("fcbc4b1a03ccbcab")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, explainingai-code/VQVAE-Pytorch when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gmvae_loss Ran
ran; our contract draft was wrong, not the code
yjlolo/vae-audio/model/loss.py
code served (permissive licence) · get_code("e051edb2ab2c496e")
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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Create tiny tensors for testing
batch_size = 2
output_dim = 4
latent_dim = 3
n_component = 2

# output and target for reconstruction loss
output = torch.randn(batch_size, output_dim)
target = torch.randn(batch_size, output_dim)

# logLogit_qy_x: log unnormalized probabilities over components (batch_size, n_component)
logLogit_qy_x = torch.randn(batch_size, n_component)

# qy_x: q(y|x) - categorical probabilities (batch_size, n_component)
qy_x = torch.softmax(torch.randn(batch_size, n_component), dim=1)

# q_mu, q_logvar: posterior parameters (batch_size, latent_dim)
q_mu = torch.randn(batch_size, latent_dim)
q_logvar = torch.randn(batch_size, latent_dim)

# mu_lookup and logvar_lookup are callables that take component index
# and return prior mean/logvar tensors (latent_dim,)
class PriorLookup(nn.Module):
    def __init__(self, n_component, latent_dim):
        super().__init__()
        self.params = nn.ParameterList([
            nn.Parameter(torch.randn(latent_dim)) for _ in range(n_component)
        ])
    
    def __call__(self, k):
        return self.params[k]

mu_lookup = PriorLookup(n_component, latent_dim)
logvar_lookup = PriorLookup(n_component, latent_dim)

ARGS = {
    'output': output,
    'target': target,
    'logLogit_qy_x': logLogit_qy_x,
    'qy_x': qy_x,
    'q_mu': q_mu,
    'q_logvar': q_logvar,
    'mu_lookup': mu_lookup,
    'logvar_lookup': logvar_lookup,
    'n_component': n_component,
}
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 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
mse_loss Ran
ran; our contract draft was wrong, not the code
yjlolo/vae-audio/model/loss.py
code served (permissive licence) · get_code("3b8e8d5673b757b1")
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 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.functional as F

torch.manual_seed(0)

# Create small tensors for output and target
# These should have the same shape
batch_size = 2
feature_dim = 4
time_steps = 3

output = torch.randn(batch_size, feature_dim, time_steps)
target = torch.randn(batch_size, feature_dim, time_steps)

avg_batch = True

ARGS = {
    "output": output,
    "target": target,
    "avg_batch": avg_batch,
}
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 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
my_metric Ran
ran on a synthesized input
yjlolo/vae-audio/model/metric.py
code served (permissive licence) · get_code("fcdafb2d7a652e72")
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 float, 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

torch.manual_seed(0)

# The function expects:
# - output: a tensor that supports torch.argmax(dim=1), shape (batch_size, num_classes)
# - target: a list or tensor with len() support, shape (batch_size,)

# Create output tensor: batch_size=2, num_classes=4
output = torch.randn(2, 4)

# Create target: batch_size=2, with class indices
target = torch.tensor([0, 2])

ARGS = {
    "output": output,
    "target": target,
}
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 float, 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
my_metric2 Ran
ran; our contract draft was wrong, not the code
yjlolo/vae-audio/model/metric.py
code served (permissive licence) · get_code("be926d5a1cd922e3")
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 float, 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

torch.manual_seed(0)

# The function computes top-k accuracy
# output: tensor of shape (batch_size, num_classes) with logits/scores
# target: tensor or list of shape (batch_size,) with class indices
# k: number of top predictions to consider

batch_size = 2
num_classes = 4

# Create output tensor: (batch_size, num_classes)
output = torch.randn(batch_size, num_classes)

# Create target tensor: (batch_size,) with class indices in range [0, num_classes)
target = torch.tensor([0, 2])

ARGS = {
    "output": output,
    "target": target,
    "k": 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 float, 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
nearest_embed Ran
ran; our contract draft was wrong, not the code
nadavbh12/VQ-VAE/vq_vae/auto_encoder.py
code served (permissive licence) · get_code("d25e16de44180a86")
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 torch
import numpy as np

torch.manual_seed(0)

# Based on the function signature, nearest_embed takes two parameters: x and emb
# x: (batch_size, emb_dim, *) - Last dimensions may be arbitrary
# emb: (emb_dim, num_emb)

# Create small test tensors
batch_size = 2
emb_dim = 4
num_arbitrary_dims = 3  # arbitrary spatial dimensions
num_emb = 5

# x should be (batch_size, emb_dim, *arbitrary_dims)
x = torch.randn(batch_size, emb_dim, num_arbitrary_dims)

# emb should be (emb_dim, num_emb)
emb = torch.randn(emb_dim, num_emb)

ARGS = {
    'x': x,
    'emb': emb
}
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 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
sample_p Ran
ran; our contract draft was wrong, not the code
sisl/MultiAgentVariationalOcclusionInference/src/driver_sensor_model/models_cvae.py
code served (permissive licence) · get_code("6ed722b4d3b12944")
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

torch.manual_seed(0)

# alpha should be a probability distribution (1D tensor that sums to 1)
# The OneHotCategorical distribution expects probabilities over categories
alpha = torch.tensor([0.2, 0.3, 0.3, 0.2])

# batch_size is an integer specifying how many samples to draw
batch_size = 2

ARGS = {
    "alpha": alpha,
    "batch_size": batch_size,
}
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 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

Showing the first 60. An agent gets every one from get_harvested_code_for_paper("1711.00937").

Also present in other papers' code

Of 80 samples lifted from this paper's linked repositories, 80 carry a function identity and 0 do not. Of the 80 distinct functions with an identity, 5 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 4 later) and 75 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
nearest_embed
brick of this paper's assembly: helper
2 other papers
2 later
2406.03234 (2024-06)
Fine-Grained Causal Dynamics Learning with Quantization for Improving Robustness in Reinforcement Learning
2412.04671 (2024-12)
Fully Distributed, Flexible Compositional Visual Representations via Soft Tensor Products
NearestEmbed
brick of this paper's assembly: model
1 other paper
1 later
2406.03234 (2024-06)
Fine-Grained Causal Dynamics Learning with Quantization for Improving Robustness in Reinforcement Learning
NearestEmbedFunc
brick of this paper's assembly: helper
1 other paper
1 later
2406.03234 (2024-06)
Fine-Grained Causal Dynamics Learning with Quantization for Improving Robustness in Reinforcement Learning
ResidualStack
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
my_metric 1 other paper
1 later
2202.14026 (2022-02)
Robust Training under Label Noise by Over-parameterization

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

More are linked than shown here.

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Learning useful representations without supervision remains a key challenge in machine learning. In this paper, we propose a simple yet powerful generative model that learns such discrete representations. Our model, the Vector Quantised-Variational AutoEncoder (VQ-VAE), differs from VAEs in two key ways: the encoder network outputs discrete, rather than continuous, codes; and the prior is learnt rather than static. In order to learn a discrete latent representation, we incorporate ideas from vector quantisation (VQ). Using the VQ method allows the model to circumvent issues of "posterior collapse" --where the latents are ignored when they are paired with a powerful autoregressive decoder --typically observed in the VAE framework. Pairing these representations with an autoregressive prior, the model can generate high quality images, videos, and speech as well as doing high quality speaker conversion and unsupervised learning of phonemes, providing further evidence of the utility of the learnt representations.

For agents

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

get_harvested_code_for_paper("1711.00937")
get_code_for_paper("1711.00937")
have("1711.00937")

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

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

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

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

Connect an agent — have() is free.