SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.02309 · ECCV · 2024

Semantically Guided Representation Learning For Action Anticipation

Bardh Prenkaj, Federico Fontana, Luigi Cinque, Anxhelo Diko, Danilo Avola

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 (4 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-22; 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/2407.02309.json · badge: /api/ran/2407.02309.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
ADiko1997/S-GEAR marked official in Papers with Code
Papers with Code archive
6 ran · 2 no recorded run
FunctionStatusWhere it lives
DropPath Ran
ran on a synthesized input · constructed an object; no result was computed
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("f4388cc6db5bce14")
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, DropPath: 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)

# Setup for DropPath module
# The __init__ takes drop_prob parameter
# The forward method expects a tensor x

# Create a small tensor to pass through the module
x = torch.randn(2, 4)

# Define ARGS dict with all parameters for DropPath.__init__
ARGS = {
    'drop_prob': 0.5
}
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 DropPath — 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 DropPath 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
ProtAttn Ran
ran on a synthesized input · constructed an object; no result was computed
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("2c1c2614fb1bd503")
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, ProtAttn: 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)

ARGS = {
    'dim': 16,
    'num_heads': 4,
    'qkv_bias': False,
    'qk_norm': False,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
    'norm_layer': nn.LayerNorm,
    'num_tmp_tokens': 10,
    'cyclic': True,
}
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 ProtAttn — 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 ProtAttn 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
SelfAttention Ran
ran on a synthesized input · constructed an object; no result was computed
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("4d0ab14d77dfb105")
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, SelfAttention: 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)

class SelfAttention(nn.Module):

    def __init__(self, dim=768, num_heads=12, qkv_bias=False, qk_norm=False, attn_drop=0.0, proj_drop=0.0, norm_layer=nn.LayerNorm):
        super(SelfAttention, self).__init__()
        assert dim % num_heads == 0, 'dim should be divisible by num_heads'
        self.num_heads = num_heads
        self.head_dim = dim // num_heads
        self.scale = self.head_dim ** (-0.5)
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.q_norm = norm_layer(self.head_dim) if qk_norm else nn.Identity()
        self.k_norm = norm_layer(self.head_dim) if qk_norm else nn.Identity()
        self.attn_drop = nn.Dropout(attn_drop)
        self.proj = nn.Linear(dim, dim)
        self.proj_drop = nn.Dropout(proj_drop)

    def forward(self, x):
        B, T, N, C = x.shape
        x = x.reshape(B * T, -1, C)
        qkv = self.qkv(x).reshape(B * T, -1, 3, self.num_heads, self.head_dim).permute(2, 0, 3, 1, 4)
        q, k, v = qkv.unbind(0)
        q, k = (self.q_norm(q), self.k_norm(k))
        q = q * self.scale
        attn = q @ k.transpose(-2, -1)
        attn = attn.softmax(dim=-1)
        attn = self.attn_drop(attn)
        x = attn @ v
        x = x.transpose(1, 2).reshape(B, T, N, C)
        x = self.proj(x)
        x = self.proj_drop(x)
        return x

# Create input tensor with shape (B, T, N, C)
# B=2 (batch), T=2 (time), N=3 (spatial), C=4 (channels)
x = torch.randn(2, 2, 3, 4)

ARGS = {
    'dim': 4,
    'num_heads': 2,
    'qkv_bias': False,
    'qk_norm': False,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
    'norm_layer': nn.LayerNorm
}
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 SelfAttention — 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 SelfAttention 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
TCAttention Ran
ran on a synthesized input · constructed an object; no result was computed
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("c2b345bea29462d2")
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, TCAttention: 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)

class TCAttention(nn.Module):

    def __init__(self, dim=768, num_heads=12, qkv_bias=False, qk_norm=False, attn_drop=0.0, proj_drop=0.0, num_tmp_tokens: int=20, norm_layer=nn.LayerNorm, shift=False):
        super(TCAttention, self).__init__()
        assert dim % num_heads == 0, 'dim should be divisible by num_heads'
        self.num_heads = num_heads
        self.head_dim = dim // num_heads
        self.scale = self.head_dim ** (-0.5)
        self.num_tmp_tokens = num_tmp_tokens
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.q_norm = norm_layer(self.head_dim) if qk_norm else nn.Identity()
        self.k_norm = norm_layer(self.head_dim) if qk_norm else nn.Identity()
        self.attn_drop = nn.Dropout(attn_drop)
        self.proj = nn.Linear(dim, dim)
        self.proj_drop = nn.Dropout(proj_drop)
        self.tmp_weighting = nn.Parameter(torch.ones(num_tmp_tokens))
        self.scaler = nn.Sigmoid()
        self.alpha = nn.Parameter(torch.tensor([0.5]))
        self.shift = shift

    @staticmethod
    def shift_(x, fold_div=3):
        B, t, c = x.size()
        fold = c // fold_div
        out = torch.zeros_like(x)
        out[:, :-1, :fold] = x[:, 1:, :fold]
        out[:, 1:, fold:2 * fold] = x[:, :-1, fold:2 * fold]
        out[:, :, 2 * fold:] = x[:, :, 2 * fold:]
        return out

    def forward(self, x, batch, attn_res=None):
        B, N, C = x.shape
        x = x.reshape(batch, -1, C)
        if self.shift:
            x = self.shift_(x)
        qkv = self.qkv(x).reshape(batch, B // batch, -1, 3, self.num_heads, self.head_dim).permute(3, 0, 1, 4, 2, 5)
        q, k, v = qkv.unbind(0)
        q, k = (self.q_norm(q), self.k_norm(k))
        tmp_v = torch.cumsum(torch.mul(v.detach().permute(0, 2, 3, 4, 1), self.tmp_weighting).permute(0, 4, 1, 2, 3), dim=1) - v.detach()
        tmp_k = torch.cumsum(torch.mul(k.detach().permute(0, 2, 3, 4, 1), self.tmp_weighting).permute(0, 4, 1, 2, 3), dim=1) - k.detach()
        v = v + tmp_v
        k = k + tmp_k
        q = q * self.scale
        attn = q @ k.transpose(-2, -1)
        if attn_res:
            scale = self.scaler(self.alpha)
            attn = scale * attn + (1 - scale) * attn_res
            attn_res = attn
        masked_tmp = torch.tril(attn, diagonal=0)
        attn = masked_tmp.softmax(dim=-1)
        attn = self.attn_drop(attn)
        x = attn @ v
        x = x.transpose(1, 2).reshape(B, N, C)
        x = self.proj(x)
        x = self.proj_drop(x)
        return (x, attn_res)


# Setup arguments for TCAttention
x = torch.randn(4, 8, 4)
batch = 2

ARGS = {
    'dim': 4,
    'num_heads': 2,
    'qkv_bias': False,
    'qk_norm': False,
    'attn_drop': 0.0,
    'proj_drop': 0.0,
    'num_tmp_tokens': 20,
    'norm_layer': nn.LayerNorm,
    'shift': 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 TCAttention — 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 TCAttention 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
TopSimilarTokens Ran
ran on a synthesized input
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("06f791fb49f18b6b")
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 3, 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

# INIT_ARGS for TopSimilarTokens.__init__
INIT_ARGS = {
    'dim': -1
}

# ARGS for TopSimilarTokens.forward
# x: (B, C) feature vector - batch size 2, feature dim 8
# mod_embeddings: (N, C) embedding tokens - 5 tokens, feature dim 8
# k: number of top indices to select
# text_embeddings: (N, C) optional text embeddings - 5 tokens, feature dim 8
# reverse: whether to return least similar instead of most similar

x = torch.randn(2, 8)
mod_embeddings = torch.randn(5, 8)
k = 3
text_embeddings = torch.randn(5, 8)
reverse = False

ARGS = {
    'x': x,
    'mod_embeddings': mod_embeddings,
    'k': k,
    'text_embeddings': text_embeddings,
    'reverse': reverse
}
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 3, 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)
drop_path Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("314973a77b15948e")
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

torch.manual_seed(0)

# Create a small tensor with batch size 2 and feature dimension 4
x = torch.randn(2, 4, dtype=torch.float32)

# Set drop probability to a value between 0 and 1
drop_prob = 0.5

# Set training flag to True to enable stochastic depth
training = True

ARGS = {
    "x": x,
    "drop_prob": drop_prob,
    "training": training,
}
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
BaseModel Not yet run
unverified (harvested, no recorded run)
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("1710791c23c4b759")
How it ran

no invocation recorded.

TCA Not yet run
unverified (harvested, no recorded run)
ADiko1997/S-GEAR/models/base_model_ts.py
code served (permissive licence) · get_code("8c53d89c3f0e62b9")
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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 6 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
DropPath
brick of this paper's assembly: helper
47 other papers
34 dated earlier, 12 later, 1 same year, order not determinable · 33 only as an assembly brick
2003.12039 (2020-03)
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
2105.14432 (2021-05)
TransMatcher: Deep Image Matching Through Transformers for Generalizable Person Re-identification
and 44 more not named here
drop_path
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2402.11301 (2024-02)
ReViT: Enhancing Vision Transformers Feature Diversity with Attention Residual Connections

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

Action anticipation is the task of forecasting future activity from a partially observed sequence of events. However, this task is exposed to intrinsic future uncertainty and the difficulty of reasoning upon interconnected actions. Unlike previous works that focus on extrapolating better visual and temporal information, we learn action representations that are aware of their semantic interconnectivity based on prototypical action patterns and contextual co-occurrences, proposing the novel Semantically Guided Representation Learning (S-GEAR) framework. S-GEAR learns visual action prototypes and leverages language models to structure their relationship, inducing semanticity. To gather insights on S-GEAR's effectiveness, we test it on four action anticipation benchmarks, obtaining improved results compared to previous works: +3.5, +2.7, and +3.5 absolute points on Top-1 Accuracy on Epic-Kitchen 55, EGTEA Gaze+ and 50 Salads, respectively, and +1.4 on Top-5 Recall on Epic-Kitchens 100. We further observe that S-GEAR effectively transfers the geometric associations between actions from language to visual prototypes. Finally, S-GEAR opens new research frontiers in anticipation tasks by demonstrating the intricate impact of action semantic interconnectivity. Code: https://github.com/ADiko1997/S-GEAR.

For agents

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

get_harvested_code_for_paper("2407.02309")
get_code_for_paper("2407.02309")
have("2407.02309")

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

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

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

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

Connect an agent — have() is free.