SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.09870 · CVPR · 2023

TeSLA: Test-Time Self-Learning With Automatic Adversarial Augmentation

Jean-Philippe Thiran, Behzad Bozorgtabar, Chuv, Devavrat Tomar, Guillaume Vray

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 2 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 2 failures of our instrument; 0 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/2303.09870.json · badge: /api/ran/2303.09870.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
devavratTomar/TeSLA canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
focal_loss Ran
ran; our contract draft was wrong, not the code
devavratTomar/TeSLA/losses/seg_losses.py
code served (permissive licence) · get_code("0748e29a637d95ec")
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 FocalLoss. 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 typing import Optional, Sequence

torch.manual_seed(0)

ARGS = {
    "alpha": [0.3, 0.7],  # Sequence of weights for 2 classes
    "gamma": 2.0,  # Focusing parameter
    "reduction": "mean",  # Reduction mode
    "ignore_index": -100,  # Class label to ignore
    "device": "cpu",  # CPU device
    "dtype": torch.float32,  # Data type for alpha tensor
}
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 FocalLoss — a FocalLoss output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FocalLoss 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
gan_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
devavratTomar/TeSLA/losses/seg_losses.py
pointer only (licence: MIT); the stored copy get_code serves, from taesungp/swapping-autoencoder-pytorch, is pointer only (licence: NOASSERTION) · get_code("8cf411cde4e9394b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from taesungp/swapping-autoencoder-pytorch, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

l_loader Ran
ran, honoured the contract we drafted
devavratTomar/TeSLA/dataloaders/classification/imagenet.py
pointer only (licence: MIT); the stored copy get_code serves, from Albert0147/AaD_SFDA, is pointer only (licence: NONE) · get_code("edd7184ac144c4fa")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from Albert0147/AaD_SFDA, and GitHub detected no licence in that repository 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.

make_dataset Ran
ran on a synthesized input
devavratTomar/TeSLA/dataloaders/classification/imagenet.py
code served (permissive licence) · get_code("bd521a3b5cd93879")
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 os
import json
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Create the imageNet_labels.json file
labels_data = {
    "0": ["n02119477", "dog"],
    "1": ["n02100735", "cat"],
    "2": ["n02084442", "horse"]
}

labels_path = os.path.join(temp_dir, 'imageNet_labels.json')
with open(labels_path, 'w') as f:
    json.dump(labels_data, f)

# Create directory structure for corrupted images
# Structure: root_dir/corruption/level/word_id/image_files
corruption_type = "gaussian_blur"
level = 1

# Create folders and dummy files
word_ids = ["n02119477", "n02100735", "n02084442"]
for word_id in word_ids:
    folder_path = os.path.join(temp_dir, corruption_type, str(level), word_id)
    os.makedirs(folder_path, exist_ok=True)
    
    # Create some dummy image files
    for i in range(2):
        dummy_file = os.path.join(folder_path, f"image_{i}.jpg")
        with open(dummy_file, 'w') as f:
            f.write("dummy image data")

ARGS = {
    "root_dir": temp_dir,
    "corruption": corruption_type,
    "level": level
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
parse_opt Ran
ran on a synthesized input
devavratTomar/TeSLA/run_with_submitit.py
code served (permissive licence) · get_code("e8a37518fb0fe089")
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 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 argparse
import sys

class MockModule:
    """Stand-in module that provides get_opt_parser method"""
    def get_opt_parser(self):
        parser = argparse.ArgumentParser(add_help=False)
        parser.add_argument('--model', default='resnet50', type=str, help='Model name')
        parser.add_argument('--lr', default=0.001, type=float, help='Learning rate')
        parser.add_argument('--batch-size', default=32, type=int, help='Batch size')
        return parser

# Create mock module instance
module_ = MockModule()

# Set up sys.argv to simulate command-line arguments
sys.argv = [
    'script_name',
    'train.py',
    '--ngpus', '2',
    '--nodes', '1',
    '--timeout', '15',
    '--partition', 'debug',
    '--comment', 'test run',
    '--model', 'resnet50',
    '--lr', '0.001',
    '--batch-size', '32'
]

ARGS = {
    'module_': module_
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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
rgb_loader Ran
ran, honoured the contract we drafted
devavratTomar/TeSLA/dataloaders/classification/imagenet.py
code served (permissive licence) · get_code("2c5ce24ea2b5d2a4")
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 Image. 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 tempfile
import os
from PIL import Image

# Create a temporary RGB image file
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple RGB image and save it
img = Image.new('RGB', (10, 10), color=(255, 0, 0))
img.save(temp_image_path)

ARGS = {
    'path': temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 2 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
rgb_loader 19 other papers
14 dated earlier, 5 later · 6 only as an assembly brick
2003.02541 (2020-03)
A Balanced and Uncertainty-aware Approach for Partial Domain Adaptation
2104.01539 (2021-04)
DINE: Domain Adaptation from Single and Multiple Black-box Predictors
2104.01845 (2021-04)
Unsupervised Multi-source Domain Adaptation Without Access to Source Data
and 16 more not named here
l_loader 17 other papers
12 dated earlier, 5 later · 5 only as an assembly brick
2003.02541 (2020-03)
A Balanced and Uncertainty-aware Approach for Partial Domain Adaptation
2104.01539 (2021-04)
DINE: Domain Adaptation from Single and Multiple Black-box Predictors
2104.01845 (2021-04)
Unsupervised Multi-source Domain Adaptation Without Access to Source Data
and 14 more not named here
focal_loss 2 other papers
2 dated earlier
1708.02002 (2017-08)
Focal Loss for Dense Object Detection
2206.11251 (2022-06)
Behavior Transformers: Cloning $k$ modes with one stone
gan_loss 1 other paper
1 dated earlier
2007.00653 (2020-07)
Swapping Autoencoder for Deep Image Manipulation

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

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

Abstract

Most recent test-time adaptation methods focus on only classification tasks, use specialized network architectures, destroy model calibration or rely on lightweight information from the source domain. To tackle these issues, this paper proposes a novel Test-time Self-Learning method with automatic Adversarial augmentation dubbed TeSLA for adapting a pre-trained source model to the unlabeled streaming test data. In contrast to conventional self-learning methods based on cross-entropy, we introduce a new test-time loss function through an implicitly tight connection with the mutual information and online knowledge distillation. Furthermore, we propose a learnable efficient adversarial augmentation module that further enhances online knowledge distillation by simulating high entropy augmented images. Our method achieves state-of-the-art classification and segmentation results on several benchmarks and types of domain shifts, particularly on challenging measurement shifts of medical images. TeSLA also benefits from several desirable properties compared to competing methods in terms of calibration, uncertainty metrics, insensitivity to model architectures, and source training strategies, all supported by extensive ablations. Our code and models are available at https://github.com/devavratTomar/TeSLA.

For agents

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

get_harvested_code_for_paper("2303.09870")
get_code_for_paper("2303.09870")
have("2303.09870")

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

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

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

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

Connect an agent — have() is free.