SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2001.01568 · 2020

Learned Image Compression with Discretized Gaussian Mixture Likelihoods and Attention Modules

arXiv · PDF · Open in the Atlas

Code that ran

8 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure of our instrument; 6 no recorded run), measured 2026-11-21; 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/2001.01568.json · badge: /api/ran/2001.01568.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
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention community (classifier label)
classifier basis not recorded on the link
8 ran · 6 no recorded run
FunctionStatusWhere it lives
CalcuPSNR Ran
ran, honoured the contract we drafted
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/models/basics.py
code served (permissive licence) · get_code("c9947c33e3a54f62")
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 math
import numpy as np
import torch

torch.manual_seed(0)

# Create small numpy arrays for target and ref
# The function expects arrays that support flatten('C') and arithmetic operations
target = np.random.rand(2, 4).astype(np.float32)
ref = np.random.rand(2, 4).astype(np.float32)

# Ensure ref and target have some difference to avoid division by zero in log10
ref = ref + 0.1

ARGS = {
    "target": target,
    "ref": ref,
}
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 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
feature_probs_based_More_Gauss Ran
ran on a synthesized input
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/model.py
code served (permissive licence) · get_code("c9b7f182fa1af125")
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 math

torch.manual_seed(0)

# Create small tensors with distinct dimensions
batch_size = 2
height = 4
width = 3
num_gaussians = 3

# feature: shape (batch, height, width) - the input feature values
feature = torch.randn(batch_size, height, width)

# means: shape (batch, height, width, 1, num_gaussians)
# Needs last dimension of size num_gaussians for indexing [:, :, :, :, 0/1/2]
means = torch.randn(batch_size, height, width, 1, num_gaussians)

# sigmas: shape (batch, height, width, 1, num_gaussians)
sigmas = torch.abs(torch.randn(batch_size, height, width, 1, num_gaussians)) + 0.1

# weights: shape (batch, height, width, 1, num_gaussians)
# Should sum to 1 for valid mixture weights
weights = torch.softmax(torch.randn(batch_size, height, width, 1, num_gaussians), dim=-1)

ARGS = {
    "feature": feature,
    "means": means,
    "sigmas": sigmas,
    "weights": weights,
}
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 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
feature_probs_based_sigma Ran
ran on a synthesized input
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/model.py
code served (permissive licence) · get_code("9e2bc979c478d250")
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 math

torch.manual_seed(0)

# Create small tensors for feature and sigma
# feature: should be a tensor of feature values
# sigma: should be a tensor of scale parameters for the Laplace distribution
feature = torch.randn(2, 4)
sigma = torch.abs(torch.randn(2, 4)) + 0.1  # Ensure positive values

ARGS = {
    "feature": feature,
    "sigma": sigma,
}
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 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
gaussian_filter Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/models/ms_ssim_torch.py
code served (permissive licence) · get_code("569f86999a28550f")
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 4, dtype family float, shape (2, 3, 2, 2) 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 torch.nn.functional as F

torch.manual_seed(0)

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

# Create 1-D Gaussian kernel
# The function expects a 4D tensor for conv2d
# Shape should be (out_channels, in_channels/groups, kernel_h, kernel_w)
# Since groups=C (channels), out_channels=C and in_channels/groups=1
# For a 1-D kernel applied as 2D: kernel_h=1, kernel_w=3 (or similar)
gaussian_kernel = torch.tensor([
    [[[0.0625, 0.25, 0.0625]]]  # shape (1, 1, 1, 3) for one channel
], dtype=torch.float32)

# Replicate for each channel (3 channels)
win = gaussian_kernel.repeat(3, 1, 1, 1)  # shape (3, 1, 1, 3)

ARGS = {
    "input": input_tensor,
    "win": win
}
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 4, dtype family float, shape (2, 3, 2, 2) — shape (2, 3, 2, 2) 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
get_loader Ran
ran on a synthesized input
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/datasets.py
code served (permissive licence) · get_code("330dd4378c3e3a35")
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 1, 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
import os
import tempfile
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create temporary directories with dummy images
temp_dir = tempfile.mkdtemp()
train_dir = os.path.join(temp_dir, 'train')
test_dir = os.path.join(temp_dir, 'test')
os.makedirs(train_dir, exist_ok=True)
os.makedirs(test_dir, exist_ok=True)

# Create dummy images for training
for i in range(3):
    img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
    img = Image.fromarray(img_array, 'RGB')
    img.save(os.path.join(train_dir, f'train_{i}.png'))

# Create dummy images for testing
for i in range(2):
    img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
    img = Image.fromarray(img_array, 'RGB')
    img.save(os.path.join(test_dir, f'test_{i}.png'))

ARGS = {
    'train_data_dir': train_dir,
    'test_data_dir': test_dir,
    'image_size': 256,
    'batch_size': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
get_train_loader Ran
ran on a synthesized input
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/datasets.py
code served (permissive licence) · get_code("4e3ec336e202299e")
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
from torch.utils.data.dataset import Dataset
from PIL import Image
import os
from glob import glob
from torchvision import transforms
import tempfile
import numpy as np

torch.manual_seed(0)

# Create a temporary directory with dummy image files
temp_dir = tempfile.mkdtemp()

# Create a few small dummy images
for i in range(3):
    img_array = np.random.randint(0, 256, (8, 8, 3), dtype=np.uint8)
    img = Image.fromarray(img_array, mode='RGB')
    img.save(os.path.join(temp_dir, f'image_{i}.png'))

ARGS = {
    'train_data_dir': temp_dir,
    'image_size': 256,
    'batch_size': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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
relu Ran
ran on a synthesized input
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/models/basics.py
code served (permissive licence) · get_code("ba24f201a717509b")
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 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# The relu function takes a single parameter 'x' and returns it
# Based on the body, x should be a tensor (or array-like)
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 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
ssim Ran
ran on a synthesized input
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/models/ms_ssim_torch.py
code served (permissive licence) · get_code("d9e269e86cc2b394")
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 as nn

torch.manual_seed(0)

# Create small sample image tensors (N, C, H, W)
# Using batch_size=2, channels=3, height=32, width=32
X = torch.randn(2, 3, 32, 32)
Y = torch.randn(2, 3, 32, 32)

# Create Gaussian kernel window (optional parameter)
# If None, it will be created inside ssim function
win = None

ARGS = {
    "X": X,
    "Y": Y,
    "win_size": 11,
    "win_sigma": 1.5,
    "win": win,
    "data_range": 255,
    "size_average": True,
    "full": False
}
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
MultiScaleSSIM Not yet run
unverified (harvested, no recorded run)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/metric.py
code served (permissive licence) · get_code("a5a05f863cc1b904")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/model.py
code served (permissive licence) · get_code("67b83d1f47e01c3f")
How it ran

no invocation recorded.

ms_ssim Not yet run
unverified (harvested, no recorded run)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/models/ms_ssim_torch.py
code served (permissive licence) · get_code("7ea107a5705e6f95")
How it ran

no invocation recorded.

msssim Not yet run
unverified (harvested, no recorded run)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/metric.py
code served (permissive licence) · get_code("c46a2076f53009e8")
How it ran

no invocation recorded.

psnr Not yet run
unverified (harvested, no recorded run)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/metric.py
code served (permissive licence) · get_code("94c8354fe1b4c307")
How it ran

no invocation recorded.

yuv_import_444 Not yet run
unverified (harvested, no recorded run)
LiuLei95/PyTorch-Learned-Image-Compression-with-GMM-and-Attention/models/basics.py
code served (permissive licence) · get_code("2784ebaef09c1269")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 12 are also present in other papers whose code we hold (12 with at least one paper dated earlier, 0 the same month, 4 later) and 2 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
gaussian_filter 4 other papers
2 dated earlier, 2 later
1409.4842 (2014-09)
Going deeper with convolutions
1611.01704 (2016-11)
End-to-end Optimized Image Compression
and 1 more not named here
MultiScaleSSIM 3 other papers
2 dated earlier, 1 later
1611.01704 (2016-11)
End-to-end Optimized Image Compression
1811.03205 (2018-11)
Robustness of Conditional GANs to Noisy Labels
2109.03082 (2021-09)
Perceptual Learned Video Compression with Recurrent Conditional GAN
CalcuPSNR 2 other papers
2 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
1812.00101 (2018-12)
DVC: An End-to-end Deep Video Compression Framework
load_model 2 other papers
1 dated earlier, 1 later
1611.01704 (2016-11)
End-to-end Optimized Image Compression
2112.08168 (2021-12)
Boosting Neural Image Compression for Machines Using Latent Space Masking
ms_ssim 2 other papers
1 dated earlier, 1 later
1611.01704 (2016-11)
End-to-end Optimized Image Compression
get_loader 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
get_train_loader 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
msssim 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
psnr 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
relu 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
ssim 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression
yuv_import_444 1 other paper
1 dated earlier
1611.01704 (2016-11)
End-to-end Optimized Image Compression

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-21.

Repositories linked to this paper

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

Abstract

Image compression is a fundamental research field and many well-known compression standards have been developed for many decades. Recently, learned compression methods exhibit a fast development trend with promising results. However, there is still a performance gap between learned compression algorithms and reigning compression standards, especially in terms of widely used PSNR metric. In this paper, we explore the remaining redundancy of recent learned compression algorithms. We have found accurate entropy models for rate estimation largely affect the optimization of network parameters and thus affect the rate-distortion performance. Therefore, in this paper, we propose to use discretized Gaussian Mixture Likelihoods to parameterize the distributions of latent codes, which can achieve a more accurate and flexible entropy model. Besides, we take advantage of recent attention modules and incorporate them into network architecture to enhance the performance. Experimental results demonstrate our proposed method achieves a state-of-the-art performance compared to existing learned compression methods on both Kodak and high-resolution datasets. To our knowledge our approach is the first work to achieve comparable performance with latest compression standard Versatile Video Coding (VVC) regarding PSNR. More importantly, our approach generates more visually pleasant results when optimized by MS-SSIM. This project page is at this https URL https://github.com/ZhengxueCheng/Learned-Image-Compression-with-GMM-and-Attention

For agents

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

get_harvested_code_for_paper("2001.01568")
get_code_for_paper("2001.01568")
have("2001.01568")

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

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

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

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

Connect an agent — have() is free.