SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.15722 · NeurIPS · 2022

PatchRot: A Self-Supervised Technique for Training Vision Transformers

Sachin Chhabra, Bijoy Prabal, Dutta, Hemanth Venkateswara, Baoxin Li

arXiv · PDF · Open in the Atlas

Code that ran

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

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2210.15722.json · badge: /api/ran/2210.15722.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
s-chh/patchrot canonical (classifier label)
classifier basis: classifier_2025
6 ran · 2 no recorded run
FunctionStatusWhere it lives
PatchRot Ran
ran on a synthesized input · constructed an object; no result was computed
s-chh/patchrot/solver_pretrain.py
code served (permissive licence) · get_code("b4ae597a4c851ff5")
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, PatchRot: 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 torchvision import transforms
from PIL import Image
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

# Create a minimal dataset stand-in
class DummyDataset:
    def __init__(self):
        pass
    
    def __len__(self):
        return 2
    
    def __getitem__(self, index):
        # Return a PIL Image and a dummy label
        img = Image.new('RGB', (64, 64), color='red')
        label = 0
        return img, label

# Create a minimal transform
def dummy_transform(img):
    return img

# Create output transform
def dummy_out_transform(img):
    return img

# Instantiate the dataset
dataset = DummyDataset()

# Define transforms
transform = dummy_transform
out_transform = dummy_out_transform

# Define parameters
image_size = 64
patch_size = 16
buffer_size = 4
train = True

ARGS = {
    'dataset': dataset,
    'transform': transform,
    'out_transform': out_transform,
    'image_size': image_size,
    'patch_size': patch_size,
    'buffer_size': buffer_size,
    'train': train
}
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 PatchRot — the run constructed an instance of its own class and did not call it; no shape 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
patchrot_classifier Ran
ran on a synthesized input · constructed an object; no result was computed
s-chh/patchrot/solver_pretrain.py
code served (permissive licence) · get_code("aae32c86517c932d")
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, patchrot_classifier: 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)

# The patchrot_classifier class takes n_classes as a parameter
# Looking at the forward method, it expects input x to be fed through fc layer
# fc is Linear(192, n_classes), so input should have feature dimension 192

ARGS = {
    "n_classes": 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type patchrot_classifier — 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 patchrot_classifier 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
reshape_batch Ran
ran; our contract draft was wrong, not the code
s-chh/patchrot/solver_pretrain.py
code served (permissive licence) · get_code("85b0c6fbda1d906b")
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

torch.manual_seed(0)

# The function expects `data` to be an iterable of tuples (x, y)
# where x and y are tensors that can be concatenated
# We create a list of 2 batches, each containing (x, y) tensors

batch1_x = torch.randn(2, 4)  # shape (2, 4)
batch1_y = torch.randn(2, 3)  # shape (2, 3)

batch2_x = torch.randn(2, 4)  # shape (2, 4)
batch2_y = torch.randn(2, 3)  # shape (2, 3)

data = [(batch1_x, batch1_y), (batch2_x, batch2_y)]

ARGS = {
    "data": data
}
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
tiny_deit Ran
ran; our contract draft was wrong, not the code
s-chh/patchrot/solver_pretrain.py
code served (permissive licence) · get_code("ac07af3582dad042")
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 VisionTransformer. 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 timm.models.vision_transformer import VisionTransformer, _cfg
from functools import partial

torch.manual_seed(0)

ARGS = {
    "input_size": 224,
    "patch_size": 16,
    "n_channels": 3,
    "n_classes": 10,
    "dynamic_img_size": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
timm, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VisionTransformer — a VisionTransformer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a VisionTransformer 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
update_args Ran
ran; our contract draft was wrong, not the code
s-chh/patchrot/main_pretrain.py
code served (permissive licence) · get_code("8b39df55e726edfc")
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 Namespace. 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 os
import json
import tempfile
from argparse import Namespace

# Create a temporary directory structure for config files
temp_dir = tempfile.mkdtemp()
config_dir = os.path.join(temp_dir, 'config')
os.makedirs(config_dir, exist_ok=True)

# Create a sample config file
sample_config = {
    'patch_size': 16,
    'pretrain_epochs': 100,
    'batch_size': 32,
    'pretrain_lr': 0.001,
    'pretrain_warmup': 10,
    'weight_decay': 0.0001,
    'image_size': 224,
    'hflip': True,
    'randomresizecrop': True,
    'padding': 4,
    'resizecrop': True,
    'n_channels': 3,
    'n_classes': 10,
    'cm': 'rgb',
    'mean': [0.485, 0.456, 0.406],
    'std': [0.229, 0.224, 0.225]
}

# Write config file
config_path = os.path.join(config_dir, 'cifar10.json')
with open(config_path, 'w') as f:
    json.dump(sample_config, f)

# Change to temp directory so relative path works
original_cwd = os.getcwd()
os.chdir(temp_dir)

# Create args object
args = Namespace(
    dataset='cifar10',
    model_path='/tmp/models',
    data_path='/tmp/data'
)

ARGS = {
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
update_args Ran
ran; our contract draft was wrong, not the code
s-chh/patchrot/main_finetune.py
code served (permissive licence) · get_code("b38402b1e21ea7bd")
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 Namespace. 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 os
import tempfile
import json
from argparse import Namespace

# Create a temporary directory structure for config files
temp_dir = tempfile.mkdtemp()
config_dir = os.path.join(temp_dir, 'config')
os.makedirs(config_dir, exist_ok=True)

# Create a sample config file for a dataset
sample_config = {
    'finetune_epochs': 100,
    'scratch_epochs': 200,
    'patch_size': 16,
    'batch_size': 32,
    'finetune_lr': 0.001,
    'finetune_warmup': 10,
    'image_size': 224,
    'weight_decay': 0.0001,
    'hflip': True,
    'randomresizecrop': True,
    'padding': 4,
    'resizecrop': True,
    'n_channels': 3,
    'n_classes': 10,
    'cm': 'rgb',
    'mean': [0.485, 0.456, 0.406],
    'std': [0.229, 0.224, 0.225]
}

# Write config file
config_path = os.path.join(config_dir, 'cifar10.json')
with open(config_path, 'w') as f:
    json.dump(sample_config, f)

# Create data and model directories
data_base_dir = os.path.join(temp_dir, 'data')
model_base_dir = os.path.join(temp_dir, 'models')
os.makedirs(data_base_dir, exist_ok=True)
os.makedirs(model_base_dir, exist_ok=True)

# Change to temp directory so config loading works
original_cwd = os.getcwd()
os.chdir(temp_dir)

# Create args object for patchrot initialization
args_patchrot = Namespace(
    dataset='cifar10',
    init='patchrot',
    n_layers_to_freeze=5,
    data_path=data_base_dir,
    model_path=model_base_dir
)

ARGS = {
    'args': args_patchrot
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
Solver Not yet run
unverified (harvested, no recorded run)
s-chh/patchrot/solver_pretrain.py
code served (permissive licence) · get_code("decc3f36ccf0b149")
How it ran

no invocation recorded.

patchrot_loader Not yet run
unverified (harvested, no recorded run)
s-chh/patchrot/solver_pretrain.py
code served (permissive licence) · get_code("e2218153f44c5613")
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

Vision transformers require a huge amount of labeled data to outperform convolutional neural networks. However, labeling a huge dataset is a very expensive process. Self-supervised learning techniques alleviate this problem by learning features similar to supervised learning in an unsupervised way. In this paper, we propose a self-supervised technique PatchRot that is crafted for vision transformers. PatchRot rotates images and image patches and trains the network to predict the rotation angles. The network learns to extract both global and local features from an image. Our extensive experiments on different datasets showcase PatchRot training learns rich features which outperform supervised learning and compared baseline.

For agents

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

get_harvested_code_for_paper("2210.15722")
get_code_for_paper("2210.15722")
have("2210.15722")

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

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

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

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

Connect an agent — have() is free.