SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.12362 · NeurIPS · 2022

Multi-dataset Training of Transformers for Robust Action Recognition

Chunhua Shen, Jun Zhang, Junwei Liang, Enwei Zhang

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 6 have no contract verdict; 1 failure 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/2209.12362.json · badge: /api/ran/2209.12362.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
JunweiLiang/MultiTrain canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
junweiliang/multitrain community
Papers with Code archive
6 ran · 1 no recorded run
FunctionStatusWhere it lives
LSEPLoss Ran
ran on a synthesized input
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("ec4d0c57187accb7")
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 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

class LSEPLoss(nn.Module):
    """
    # http://openaccess.thecvf.com/content_cvpr_2017/html/Li_Improving_Pairwise_Ranking_CVPR_2017_paper.html
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(LSEPLoss, self).__init__()
        self.reduction = reduction

    def forward(self, scores, labels):
        mask = (labels.unsqueeze(1).expand(labels.size(0), labels.size(1), labels.size(1)) - labels.unsqueeze(2).expand(labels.size(0), labels.size(1), labels.size(1)) > 0).float()
        loss = scores.unsqueeze(2).expand(labels.size(0), labels.size(1), labels.size(1)) - scores.unsqueeze(1).expand(labels.size(0), labels.size(1), labels.size(1))
        loss = loss.exp().mul(mask).sum().add(1).log()
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError


INIT_ARGS = {
    'reduction': 'mean'
}

ARGS = {
    'scores': torch.randn(2, 4),
    'labels': torch.randn(2, 4)
}

if __name__ == '__main__':
    model = LSEPLoss(**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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MeanAbsoluteError Ran
ran on a synthesized input
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("0dac89749d6d9308")
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 0, 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 torch.nn.functional as F

class MeanAbsoluteError(nn.Module):
    """
    mean absolute error loss, it is said to be more robust to label noise compared
    to CE loss
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(MeanAbsoluteError, self).__init__()
        self.reduction = reduction

    def forward(self, x, y):
        pred = F.softmax(x, dim=-1)
        loss = 1.0 - torch.sum(y * pred, dim=-1)
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError


INIT_ARGS = {
    'reduction': 'mean'
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': torch.softmax(torch.randn(2, 4), dim=-1)
}

if __name__ == '__main__':
    model = MeanAbsoluteError(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output: {output}")
    print(f"Output shape: {output.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 Tensor, ndim 0, 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)
NCEandRCE Ran
ran on a synthesized input
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("038b53347cdfe89b")
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 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
import torch.nn.functional as F

class NormalizedSoftTargetCrossEntropy(nn.Module):
    """
    Normalized Cross entropy loss with soft target. For MixUp train
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(NormalizedSoftTargetCrossEntropy, self).__init__()
        self.reduction = reduction

    def forward(self, x, y):
        pred = F.log_softmax(x, dim=-1)
        loss = -torch.sum(y * pred, dim=-1) / -pred.sum(dim=-1)
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError

class ReverseSoftTargetCrossEntropy(nn.Module):
    """
    Reverse Cross entropy loss with soft target. For MixUp train
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(ReverseSoftTargetCrossEntropy, self).__init__()
        self.reduction = reduction

    def forward(self, x, y):
        pred = F.softmax(x, dim=-1)
        pred = torch.clamp(pred, min=1e-07, max=1.0)
        y = torch.clamp(y, min=0.0001, max=1.0)
        y = torch.log(y)
        loss = -torch.sum(y * pred, dim=-1)
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError

class NCEandRCE(nn.Module):

    def __init__(self, alpha=1.0, beta=1.0, reduction='mean'):
        super(NCEandRCE, self).__init__()
        self.alpha = alpha
        self.beta = beta
        self.nce = NormalizedSoftTargetCrossEntropy(reduction=reduction)
        self.rce = ReverseSoftTargetCrossEntropy(reduction=reduction)

    def forward(self, pred, labels):
        return self.alpha * self.nce(pred, labels) + self.beta * self.rce(pred, labels)


INIT_ARGS = {
    'alpha': 0.5,
    'beta': 0.7,
    'reduction': 'mean'
}

ARGS = {
    'pred': torch.randn(2, 4),
    'labels': torch.softmax(torch.randn(2, 4), dim=-1)
}

if __name__ == '__main__':
    model = NCEandRCE(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output: {output}")
    print(f"Output shape: {output.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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
NormalizedSoftTargetCrossEntropy Ran
ran on a synthesized input
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("5007808e58a0cf6a")
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 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
import torch.nn.functional as F

class NormalizedSoftTargetCrossEntropy(nn.Module):
    """
    Normalized Cross entropy loss with soft target. For MixUp train
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(NormalizedSoftTargetCrossEntropy, self).__init__()
        self.reduction = reduction

    def forward(self, x, y):
        pred = F.log_softmax(x, dim=-1)
        loss = -torch.sum(y * pred, dim=-1) / -pred.sum(dim=-1)
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError


INIT_ARGS = {
    'reduction': 'mean'
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': torch.softmax(torch.randn(2, 4), dim=-1)
}

if __name__ == '__main__':
    model = NormalizedSoftTargetCrossEntropy(**INIT_ARGS)
    output = model(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output value: {output}")
    
    model_none = NormalizedSoftTargetCrossEntropy(reduction='none')
    output_none = model_none(**ARGS)
    print(f"Output (reduction='none') shape: {output_none.shape}")
    print(f"Output (reduction='none') value: {output_none}")
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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
ReverseSoftTargetCrossEntropy Ran
ran on a synthesized input
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("95fb2d4c767dc202")
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 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
import torch.nn.functional as F

class ReverseSoftTargetCrossEntropy(nn.Module):
    """
    Reverse Cross entropy loss with soft target. For MixUp train
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(ReverseSoftTargetCrossEntropy, self).__init__()
        self.reduction = reduction

    def forward(self, x, y):
        pred = F.softmax(x, dim=-1)
        pred = torch.clamp(pred, min=1e-07, max=1.0)
        y = torch.clamp(y, min=0.0001, max=1.0)
        y = torch.log(y)
        loss = -torch.sum(y * pred, dim=-1)
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError


INIT_ARGS = {
    'reduction': 'mean'
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': torch.softmax(torch.randn(2, 4), dim=-1)
}

if __name__ == '__main__':
    model = ReverseSoftTargetCrossEntropy(**INIT_ARGS)
    output = model(**ARGS)
    print("Output:", output)
    print("Output shape:", output.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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SoftTargetCrossEntropy Ran
ran on a synthesized input
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("666787bd3939df7c")
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 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
import torch.nn.functional as F

class SoftTargetCrossEntropy(nn.Module):
    """
    Cross entropy loss with soft target. For MixUp train
    """

    def __init__(self, reduction='mean'):
        """
        Args:
            reduction (str): specifies reduction to apply to the output. It can be
                "mean" (default) or "none".
        """
        super(SoftTargetCrossEntropy, self).__init__()
        self.reduction = reduction

    def forward(self, x, y):
        loss = torch.sum(-y * F.log_softmax(x, dim=-1), dim=-1)
        if self.reduction == 'mean':
            return loss.mean()
        elif self.reduction == 'none':
            return loss
        else:
            raise NotImplementedError


INIT_ARGS = {
    'reduction': 'mean'
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': torch.softmax(torch.randn(2, 4), dim=-1)
}

if __name__ == '__main__':
    loss_fn = SoftTargetCrossEntropy(**INIT_ARGS)
    output = loss_fn(**ARGS)
    print(f"Output shape: {output.shape}")
    print(f"Output value: {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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
read_val_data Ran
ran; our contract draft was wrong, not the code
JunweiLiang/MultiTrain/tools/train_net.py
code served (permissive licence) · get_code("39a9b846b179205b")
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 dict. 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 pickle
import tempfile

# Create a temporary directory for the test
temp_dir = tempfile.mkdtemp()

# Create a sample val_record dictionary
val_record = {
    'loss': {0: 0.5, 1: 0.4, 2: 0.3},
    'accuracy': {0: 0.7, 1: 0.8, 2: 0.85}
}

# Save the val_record to a pickle file
save_file = os.path.join(temp_dir, 'val_record.pkl')
with open(save_file, 'wb') as f:
    pickle.dump(val_record, f)

# Create a config object with OUTPUT_DIR attribute
class Config:
    def __init__(self, output_dir):
        self.OUTPUT_DIR = output_dir

cfg = Config(temp_dir)

ARGS = {
    'cfg': cfg
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
MultiHeadLoss Not yet run
unverified (harvested, no recorded run)
junweiliang/multitrain/slowfast/models/losses.py
code served (permissive licence) · get_code("40418acd5604e86d")
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

We study the task of robust feature representations, aiming to generalize well on multiple datasets for action recognition. We build our method on Transformers for its efficacy. Although we have witnessed great progress for video action recognition in the past decade, it remains challenging yet valuable how to train a single model that can perform well across multiple datasets. Here, we propose a novel multidataset training paradigm, MultiTrain, with the design of two new loss terms, namely informative loss and projection loss, aiming to learn robust representations for action recognition. In particular, the informative loss maximizes the expressiveness of the feature embedding while the projection loss for each dataset mines the intrinsic relations between classes across datasets. We verify the effectiveness of our method on five challenging datasets, Kinetics-400, Kinetics-700, Moments-in-Time, Activitynet and Something-something-v2 datasets. Extensive experimental results show that our method can consistently improve state-of-the-art performance. Code and models are available at https://github.com/JunweiLiang/MultiTrain

For agents

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

get_harvested_code_for_paper("2209.12362")
get_code_for_paper("2209.12362")
have("2209.12362")

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

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

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

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

Connect an agent — have() is free.