SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2304.03431 · ICLR · 2023

Domain Generalization In Robust Invariant Representation

Ramesh Raskar, Gauri Gupta, Ritvik Kapila, Keshav Gupta

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2304.03431.json · badge: /api/ran/2304.03431.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
GauriGupta19/Domain-Generalisation-in-Invariance canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
get_rotated_mnist Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/data.py
code served (permissive licence) · get_code("d5c367aea4394aa2")
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
from PIL import Image
from torchvision.transforms import ToTensor

torch.manual_seed(0)

# Create a minimal mock dataset that behaves like MNIST
class MockMNISTDataset:
    def __init__(self, num_samples=2):
        self.num_samples = num_samples
        # Create dummy grayscale images (28x28 like MNIST)
        self.data = torch.zeros((num_samples, 1, 28, 28), dtype=torch.uint8)
        self.labels = torch.randint(0, 10, (num_samples,))
    
    def __len__(self):
        return self.num_samples
    
    def __iter__(self):
        for i in range(self.num_samples):
            # Convert tensor to PIL Image for rotation
            img_array = self.data[i].squeeze().numpy().astype('uint8')
            pil_img = Image.fromarray(img_array, mode='L')
            label = self.labels[i].item()
            yield (pil_img, label)

# Create mock dataset
mock_dataset = MockMNISTDataset(num_samples=2)

# Define rotation range (in degrees)
rotation_range = (0, 45)

ARGS = {
    'dataset': mock_dataset,
    'rotation_range': rotation_range
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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
get_rotated_mnist_sample Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/data.py
code served (permissive licence) · get_code("d51aef625b923c62")
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
from PIL import Image
from torchvision.transforms import ToTensor

torch.manual_seed(0)

# Create a minimal dataset as a list of (image, label) tuples
# The function iterates through dataset and calls .rotate() on images
# and accesses label as an integer for indexing into count tensor

# Create simple PIL images (28x28 grayscale, typical MNIST size)
dataset = []
for i in range(25):
    # Create a simple PIL image
    img_array = torch.randint(0, 256, (28, 28), dtype=torch.uint8).numpy()
    pil_img = Image.fromarray(img_array, mode='L')
    label = i % 10  # Labels 0-9
    dataset.append((pil_img, label))

# rotation_range is used in torch.randint(*rotation_range, (1,))
# So it should be a tuple of (low, high) integers
rotation_range = (0, 90)

# n_samples: number of samples per class
n_samples = 2

ARGS = {
    'dataset': dataset,
    'n_samples': n_samples,
    'rotation_range': rotation_range,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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
get_translated_mnist Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/data.py
code served (permissive licence) · get_code("157996285950c6c7")
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
from PIL import Image
from torchvision.transforms import ToTensor

torch.manual_seed(0)

# Create a minimal mock dataset
class MockMNISTDataset:
    def __init__(self, num_samples=2, img_size=4):
        # Create small fake MNIST-like data
        self.data = torch.zeros((num_samples, 1, img_size, img_size), dtype=torch.uint8)
        self.targets = torch.tensor([0, 1])
        self.num_samples = num_samples
        self.img_size = img_size
    
    def __len__(self):
        return self.num_samples
    
    def __getitem__(self, idx):
        # Return PIL Image and label as the function expects
        # Convert tensor to PIL Image
        img_array = self.data[idx].squeeze().numpy()
        img = Image.fromarray(img_array.astype('uint8'), mode='L')
        label = int(self.targets[idx])
        return img, label

# Instantiate the mock dataset
dataset = MockMNISTDataset(num_samples=2, img_size=4)

# Define translation range
translation_range = (0, 2)

ARGS = {
    'dataset': dataset,
    'translation_range': translation_range
}
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
grid2xy Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/functions.py
code served (permissive licence) · get_code("9ba31ba7756ead17")
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 (8, 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

torch.manual_seed(0)

# Create two small tensors that can be used as grid coordinates
# X1 and X2 should be 2D tensors since the function applies [None] indexing
# and then reshapes them. Based on the function logic:
# - X1[None] adds a dimension at the start
# - X2[None] adds a dimension at the start
# - They are concatenated along dimension 0
# So X1 and X2 should have shape (height, width) or similar

X1 = torch.randn(2, 4)  # shape (2, 4)
X2 = torch.randn(2, 4)  # shape (2, 4)

ARGS = {
    "X1": X1,
    "X2": X2,
}
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 (8, 2) — shape (8, 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
imcoordgrid Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/functions.py
code served (permissive licence) · get_code("8ba5d7b07507acee")
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 (12, 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

torch.manual_seed(0)

ARGS = {
    "im_dim": (4, 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 Tensor, ndim 2, dtype family float, shape (12, 2) — shape (12, 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
make_fc_layers Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/models.py
code served (permissive licence) · get_code("e38741aac5e5d0e5")
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 = {
    'in_dim': 4,
    'hidden_dim': 128,
    'num_layers': 2,
    'activation': 'tanh'
}
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
to_onehot Ran
ran on a synthesized input
GauriGupta19/Domain-Generalisation-in-Invariance/src/functions.py
code served (permissive licence) · get_code("512643e9de295e91")
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 (4, 4) as a later run recorded it. 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, 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)

# Create a 1D tensor of class indices
# Values must be in range [0, n-1] where n is the number of classes
idx = torch.tensor([0, 2, 1, 0], dtype=torch.long)

# Number of classes
n = 4

ARGS = {
    'idx': idx,
    'n': n,
}
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 (4, 4) — shape (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: none by the harness; any seed is in the setup block
train_nn Not yet run
unverified (harvested, no recorded run)
GauriGupta19/Domain-Generalisation-in-Invariance/src/classifier.py
code served (permissive licence) · get_code("b1fd1a443da9001d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

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

Abstract

Unsupervised approaches for learning representations invariant to common transformations are used quite often for object recognition. Learning invariances makes models more robust and practical to use in real-world scenarios. Since data transformations that do not change the intrinsic properties of the object cause the majority of the complexity in recognition tasks, models that are invariant to these transformations help reduce the amount of training data required. This further increases the model's efficiency and simplifies training. In this paper, we investigate the generalization of invariant representations on out-of-distribution data and try to answer the question: Do model representations invariant to some transformations in a particular seen domain also remain invariant in previously unseen domains? Through extensive experiments 1 , we demonstrate that the invariant model learns unstructured latent representations that are robust to distribution shifts, thus making invariance a desirable property for training in resource-constrained settings.

For agents

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

get_harvested_code_for_paper("2304.03431")
get_code_for_paper("2304.03431")
have("2304.03431")

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

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

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

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

Connect an agent — have() is free.