SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2108.12630 · ICCV · 2021

GroupFormer: Group Activity Recognition with Clustered Spatial-Temporal Transformer

Shuai Yi, Kunlin Yang, Jun Hou, Lingbo Liu, Shuaicheng Li, Qianggang Cao, Shinan Liu

arXiv · PDF · Open in the Atlas

Code that ran

22 of 27 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; 3 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 14 failures of our instrument; 5 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/2108.12630.json · badge: /api/ran/2108.12630.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
xueyee/groupformer canonical (classifier label)
classifier basis: census
5 ran · 3 no recorded run
xueyee/GroupFormer community
Papers with Code archive
15 ran · 2 no recorded run
copy not recorded community
not in the paper's declared repositories
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Kmeans Ran
ran on a synthesized input · constructed an object; no result was computed
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("c125449e7df4ac6d")
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, Kmeans: 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
import torch.distributed as dist
from unittest.mock import patch

torch.manual_seed(0)

# Mock torch.distributed.get_world_size to return 1
# since we're running single-process
def mock_get_world_size():
    return 1

ARGS = {
    'num_heads': 2,
    'head_dim': 4,
    'num_clusters': 3,
    'ema_decay': 0.999,
    'commitment': 0.0001,
}

# Patch dist.get_world_size before any imports that might use it
with patch('torch.distributed.get_world_size', side_effect=mock_get_world_size):
    pass
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 Kmeans — 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 Kmeans 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
KmeansAttention Ran
ran on a synthesized input · constructed an object; no result was computed
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("daba1d12c937fb50")
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, KmeansAttention: 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 = {
    "num_clusters": 8,
    "window_size": 4,
    "num_heads": 2,
    "head_dim": 3,
    "causal": False,
    "dropout": 0.1,
    "ema_decay": 0.999,
    "commitment": 0.0001,
    "context_window_size": None,
    "receives_context": False,
    "num_mem_kv": 0,
    "shared_qk": 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 KmeansAttention — 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 KmeansAttention 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
batched_bincount Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("3c9e316e182b4d7d")
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 int, shape (2, 3) 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 batched index tensor
# Shape: (batch_size=2, sequence_length=4)
# Values should be class indices in range [0, num_classes)
index = torch.tensor([
    [0, 1, 2, 1],
    [2, 0, 1, 2]
], dtype=torch.long)

num_classes = 3

dim = -1

ARGS = {
    "index": index,
    "num_classes": num_classes,
    "dim": dim,
}
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 int, shape (2, 3) — shape (2, 3) 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
batched_index_select Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("098a5dd15c0b4167")
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 3, dtype family float, shape (2, 3, 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
import torch.nn as nn

torch.manual_seed(0)

# Create test tensors for batched_index_select
# values: shape (batch, seq_len, last_dim) = (2, 3, 4)
# indices: shape (batch, seq_len) = (2, 3)
# The function will gather along dim 2 using indices expanded to (batch, seq_len, last_dim)

values = torch.randn(2, 3, 4)
indices = torch.randint(0, 4, (2, 3))

ARGS = {
    "values": values,
    "indices": indices
}
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
cache_fn Ran
ran on a synthesized input
xueyee/groupformer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("c849eae4bd18f599")
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 function. 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 functools import partial, reduce, wraps

torch.manual_seed(0)

def cache_fn(f):
    cache = None

    @wraps(f)
    def cached_fn(*args, **kwargs):
        nonlocal cache
        if cache is not None:
            return cache
        cache = f(*args, **kwargs)
        return cache
    return cached_fn

# Define a simple test function to pass to cache_fn
def simple_computation(x, y):
    """A simple function that will be wrapped by cache_fn"""
    return x + y

# The cache_fn decorator takes a function as its only parameter
ARGS = {
    'f': simple_computation
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
cast_tuple Ran
ran, honoured the contract we drafted
xueyee/groupformer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("e0b73c0c3c680d31")
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, ndim 1, dtype family int; 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

torch.manual_seed(0)

# The function cast_tuple takes a single parameter 'x' and returns it as a tuple
# if it's not already a tuple, or returns it unchanged if it is a tuple.
# We need to test both cases.

# Test case 1: x is not a tuple (e.g., an integer, string, tensor, list, etc.)
x_not_tuple = 42

ARGS = {
    "x": x_not_tuple
}
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, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
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
default Ran
ran, honoured the contract we drafted
xueyee/groupformer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("ebbe83e33bdee406")
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 int, ndim 0, dtype family int, 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
from inspect import isfunction

torch.manual_seed(0)

def ARGS_default_x():
    """A callable that returns a default value"""
    return 42

def ARGS_default_static():
    """A static default value"""
    return "default_value"

# Test case 1: x is None, d is a static value
ARGS = {
    "x": None,
    "d": 100
}
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 int, ndim 0, dtype family int, 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: none by the harness; any seed is in the setup block
distribution Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("c88722608edfbb70")
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 3, dtype family int, shape (2, 4, 3) 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)

# dists is a tensor that will have topk called on it
# topk(k=window_size, dim=-2) means we're selecting top k along dimension -2
# The result has shape where we transpose(-2, -1) and then reshape
# Let's build a tensor where dim=-2 has at least window_size elements
# and other dimensions exist for the reshape to work properly

window_size = 3
batch_size = 2
num_features = 4
sequence_length = 5

# Create a tensor with shape (batch_size, sequence_length, num_features)
# so that dim=-2 is sequence_length (which is 5, >= window_size of 3)
dists = torch.randn(batch_size, sequence_length, num_features)

ARGS = {
    "dists": dists,
    "window_size": window_size
}
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 3, dtype family int, shape (2, 4, 3) — shape (2, 4, 3) 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
dists_and_buckets Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("45afc9429eea1b63")
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)

# Analyze the function:
# dists_and_buckets(x, means) calls:
# - similarity(x, means) which does torch.einsum('bhld,hcd->bhlc', x, means)
# - torch.max(dists, dim=-1)
#
# From einsum 'bhld,hcd->bhlc':
# - x has shape (b, h, l, d)
# - means has shape (h, c, d)
# - output has shape (b, h, l, c)
#
# We need:
# - b: batch dimension (use 2)
# - h: head dimension (use 3)
# - l: length dimension (use 4)
# - d: feature dimension (use 5)
# - c: cluster/class dimension (use 6)

b, h, l, d, c = 2, 3, 4, 5, 6

# Create x with shape (b, h, l, d) = (2, 3, 4, 5)
x = torch.randn(b, h, l, d)

# Create means with shape (h, c, d) = (3, 6, 5)
means = torch.randn(h, c, d)

ARGS = {
    'x': x,
    'means': means,
}
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
ema Ran
ran, honoured the contract we drafted
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("f70774c0916069a5")
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
import numpy as np

torch.manual_seed(0)

# The function ema takes three parameters: old, new, and decay
# - old: can be None or a tensor (supports multiplication and addition)
# - new: a tensor (supports multiplication and addition)
# - decay: a scalar (float, supports multiplication)

# Create small test tensors
old_tensor = torch.randn(2, 4)
new_tensor = torch.randn(2, 4)
decay_value = 0.9

ARGS = {
    "old": old_tensor,
    "new": new_tensor,
    "decay": decay_value,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
expand_dim Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from lucidrains/scattering-compositional-learner
pointer only; the stored copy get_code serves, from lucidrains/scattering-compositional-learner, is pointer only (licence: NONE) · get_code("270b669b4662f5c1")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

find_modules Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from microsoft/vision-longformer
pointer only · get_code("4e291c3ece372165")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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.

kmeans_iter Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("266f3de8e8cd3655")
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 3, dtype family float, shape (3, 6, 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
import torch.nn.functional as F

torch.manual_seed(0)

# Analyzing kmeans_iter to understand required arguments:
# - x: used with .shape (b, h, l, d), .dtype, .unsqueeze, .scatter_add_
#   Needs to be a float tensor with 4 dimensions
# - means: used with .shape (extracting num_clusters from dim 1), used in similarity()
#   which does einsum 'bhld,hcd->bhlc', so means needs shape (h, c, d)
# - buckets: optional, defaults to None, used with .new_zeros() and in expand_dim
#   Should be indices tensor with shape (b, h, l)

# Setting distinct sizes for each dimension:
# b=2 (batch), h=3 (heads), l=5 (sequence length), d=4 (feature dim), c=6 (num_clusters)
b, h, l, d, c = 2, 3, 5, 4, 6

# Create x: (b, h, l, d) - normalized float tensor
x = torch.randn(b, h, l, d)
x = F.normalize(x, dim=-1)

# Create means: (h, c, d) - normalized float tensor
means = torch.randn(h, c, d)
means = F.normalize(means, dim=-1)

# Create buckets: (b, h, l) - cluster assignments (indices)
buckets = torch.randint(0, c, (b, h, l))

ARGS = {
    "x": x,
    "means": means,
    "buckets": buckets,
}
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 3, dtype family float, shape (3, 6, 4) — shape (3, 6, 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
max_neg_value Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("b209878199e80c50")
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 float, 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

torch.manual_seed(0)

# The function takes a tensor and accesses its dtype attribute,
# then calls torch.finfo on it to get the max value for that dtype.
# We need to construct a valid tensor with a supported dtype.

tensor = torch.randn(2, 4, dtype=torch.float32)

ARGS = {
    "tensor": 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 float, 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: none by the harness; any seed is in the setup block
multi_head_attention_forward Ran
ran on a synthesized input
xueyee/groupformer/group/models/transformer_cluster.py
code served (permissive licence) · get_code("8e2156fc442de944")
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 torch.nn as nn
from typing import Optional, Tuple

torch.manual_seed(0)

# Define dimensions
embed_dim = 8
num_heads = 2
head_dim = embed_dim // num_heads
batch_size = 2
tgt_len = 3
src_len = 4

# Create query, key, value tensors
# Shape: (seq_len, batch_size, embed_dim)
query = torch.randn(tgt_len, batch_size, embed_dim)
key = torch.randn(src_len, batch_size, embed_dim)
value = torch.randn(src_len, batch_size, embed_dim)

# Input projection weights and bias
# in_proj_weight combines q, k, v projections: shape (3*embed_dim, embed_dim)
in_proj_weight = torch.randn(3 * embed_dim, embed_dim)
in_proj_bias = torch.randn(3 * embed_dim)

# Output projection weights and bias
out_proj_weight = torch.randn(embed_dim, embed_dim)
out_proj_bias = torch.randn(embed_dim)

# Optional bias tensors for key and value
bias_k = None
bias_v = None

# Key padding mask: (batch_size, src_len)
key_padding_mask = None

# Attention mask: 2D (tgt_len, src_len)
attn_mask = None

# Static k and v for incremental decoding (optional)
static_k = None
static_v = None

# Separate projection weights (only used if use_separate_proj_weight=True)
q_proj_weight = None
k_proj_weight = None
v_proj_weight = None

ARGS = {
    'query': query,
    'key': key,
    'value': value,
    'embed_dim_to_check': embed_dim,
    'num_heads': num_heads,
    'in_proj_weight': in_proj_weight,
    'in_proj_bias': in_proj_bias,
    'bias_k': bias_k,
    'bias_v': bias_v,
    'add_zero_attn': False,
    'dropout_p': 0.0,
    'out_proj_weight': out_proj_weight,
    'out_proj_bias': out_proj_bias,
    'training': True,
    'key_padding_mask': key_padding_mask,
    'need_weights': True,
    'attn_mask': attn_mask,
    'use_separate_proj_weight': False,
    'q_proj_weight': q_proj_weight,
    'k_proj_weight': k_proj_weight,
    'v_proj_weight': v_proj_weight,
    'static_k': static_k,
    'static_v': static_v,
}
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
reshape_dim Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("2866aa5c23d64139")
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 4, dtype family float, shape (2, 1, 3, 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 to reshape
# Using shape (2, 3, 4) so we have multiple dimensions to work with
t = torch.randn(2, 3, 4)

# dim parameter: which dimension to split
# Using dim=1 to split the middle dimension
dim = 1

# split_dims parameter: the new dimensions to replace the target dimension with
# Original dimension 1 has size 3, so we can split it into (1, 3) or other combinations
# Let's split it into two dimensions: (1, 3)
split_dims = (1, 3)

ARGS = {
    "t": t,
    "dim": dim,
    "split_dims": split_dims,
}
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 4, dtype family float, shape (2, 1, 3, 4) — shape (2, 1, 3, 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
scatter_mean Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("e437fa79b7c02bfb")
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)

# Analyze the function:
# - src: tensor used with scatter_add method
# - t: tensor used with scatter_add and ones_like
# - index: tensor used as indices for scatter_add
# - dim: dimension parameter for scatter_add
# - eps: small float for numerical stability

# Create small tensors with distinct shapes
# src: shape (2, 4) - source tensor
# t: shape (2, 3) - values to scatter
# index: shape (2, 3) - indices, must match t's shape, values < src.shape[dim]
# dim: 1 (dimension to scatter along)

src = torch.randn(2, 4)
t = torch.randn(2, 3)
index = torch.tensor([[0, 1, 2], [1, 2, 3]], dtype=torch.long)
dim = 1
eps = 1e-05

ARGS = {
    "src": src,
    "t": t,
    "index": index,
    "dim": dim,
    "eps": eps,
}
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
similarity Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("4d588005f814f46d")
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 4, dtype family float, shape (2, 3, 4, 6) 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)

# x: shape (b, h, l, d) where b=batch, h=heads, l=sequence_length, d=feature_dim
x = torch.randn(2, 3, 4, 5)

# means: shape (h, c, d) where h=heads, c=num_classes, d=feature_dim
means = torch.randn(3, 6, 5)

ARGS = {
    'x': x,
    'means': means
}
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 4, dtype family float, shape (2, 3, 4, 6) — shape (2, 3, 4, 6) 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
split_at_index Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("79eb67938353bd45")
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, ndim 5, 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 numpy as np

torch.manual_seed(0)

# Construct arguments for split_at_index(dim, index, t)
# The function splits a tensor t along dimension dim at the given index

# Create a small tensor with distinct dimensions for probing
# Shape: (2, 3, 4, 5) - batch=2, then varying sizes
t = torch.randn(2, 3, 4, 5)

# dim: which dimension to split along (0-3 valid for 4D tensor)
dim = 2

# index: where to split along that dimension
# For dim=2, the size is 4, so valid indices are 0-4
index = 2

ARGS = {
    "dim": dim,
    "index": index,
    "t": t
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
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
to Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("f092dd8a37a00a6e")
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 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 torch

torch.manual_seed(0)

# Create a small tensor to pass to the function
t = torch.randn(2, 4, dtype=torch.float32, device='cpu')

# The function takes parameter 't' and accesses t.device and t.dtype
# We need to pass a tensor with these attributes
ARGS = {
    't': t
}
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 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
update_kmeans_on_backwards Ran
ran; our contract draft was wrong, not the code
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("1643840480c9ad87")
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 RemovableHandle. 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
import torch.distributed as dist
from unittest.mock import MagicMock, patch

torch.manual_seed(0)

# Mock dist.get_world_size to return 1 since we're not using actual distributed setup
with patch('torch.distributed.get_world_size', return_value=1):
    # Create a minimal module that contains Kmeans instances
    class MinimalModule(nn.Module):
        def __init__(self):
            super().__init__()
            self.kmeans1 = nn.Module()  # Placeholder for finding modules
            self.kmeans2 = nn.Module()  # Placeholder for finding modules
        
        def forward(self, x):
            return x
    
    # Create the module to pass to update_kmeans_on_backwards
    module = MinimalModule()

ARGS = {
    'module': module
}
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 RemovableHandle — a RemovableHandle output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RemovableHandle 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
volley_all_frames Ran
ran on a synthesized input
xueyee/groupformer/group/datasets/volleyball.py
code served (permissive licence) · get_code("415a573251464da5")
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 list, ndim 2, 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

torch.manual_seed(0)

# Construct valid arguments for volley_all_frames
# The function expects a dict where:
# - keys are session IDs (sid)
# - values are dicts where:
#   - keys are frame IDs (fid)
#   - values are annotations (ann)

data = {
    "session_1": {
        "frame_0": {"label": 1},
        "frame_1": {"label": 2},
    },
    "session_2": {
        "frame_0": {"label": 3},
        "frame_2": {"label": 4},
    },
    "session_3": {
        "frame_1": {"label": 5},
    }
}

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 list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
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
ClusteringTransformer Not yet run
unverified (harvested, no recorded run)
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("208f65adecf9a0f7")
How it ran

no invocation recorded.

SelfAttention Not yet run
unverified (harvested, no recorded run)
xueyee/GroupFormer/group/models/cluster_transformer.py
code served (permissive licence) · get_code("76f9cb9ada2064dc")
How it ran

no invocation recorded.

build_transformer Not yet run
unverified (harvested, no recorded run)
xueyee/groupformer/group/models/transformer.py
code served (permissive licence) · get_code("302ec916d91b12a8")
How it ran

no invocation recorded.

volley_read_annotations Not yet run
unverified (harvested, no recorded run)
xueyee/groupformer/group/datasets/volleyball.py
code served (permissive licence) · get_code("ca074ca0c718a909")
How it ran

no invocation recorded.

volley_read_dataset Not yet run
unverified (harvested, no recorded run)
xueyee/groupformer/group/datasets/volleyball.py
code served (permissive licence) · get_code("1bf81af39059aefe")
How it ran

no invocation recorded.

Also present in other papers' code

Of 27 samples lifted from this paper's linked repositories, 27 carry a function identity and 0 do not. Of the 27 distinct functions with an identity, 14 are also present in other papers whose code we hold (13 with at least one paper dated earlier, 1 the same month, 5 later) and 13 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
build_transformer 32 other papers
6 dated earlier, 1 the same month, 25 later
2005.12872 (2020-05)
End-to-End Object Detection with Transformers
2103.12115 (2021-03)
End-to-End Trainable Multi-Instance Pose Estimation with Transformers
2104.04369 (2021-04)
Video-aided Unsupervised Grammar Induction
and 29 more not named here
max_neg_value
brick of this paper's assembly: helper
4 other papers
2 dated earlier, 2 later · 3 only as an assembly brick
2006.15020 (2020-06)
Pre-training via Paraphrasing
2105.14850 (2021-05)
Cascaded Head-colliding Attention
2506.16640 (2025-06)
Long-Context Generalization with Sparse Attention
and 1 more not named here
expand_dim
brick of this paper's assembly: helper
3 other papers
2 dated earlier, 1 later · 1 only as an assembly brick
2007.04212 (2020-07)
The Scattering Compositional Learner: Discovering Objects, Attributes, Relationships in Analogical Reasoning
2105.14850 (2021-05)
Cascaded Head-colliding Attention
2206.05379 (2022-06)
A Benchmark for Compositional Visual Reasoning
find_modules
brick of this paper's assembly: helper
3 other papers
2 dated earlier, 1 later · 1 only as an assembly brick
2102.12122 (2021-02)
Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions
2103.15358 (2021-03)
Multi-Scale Vision Longformer: A New Vision Transformer for High-Resolution Image Encoding
2401.16423 (2024-01)
Synchformer: Efficient Synchronization from Sparse Cues
to
brick of this paper's assembly: helper
2 other papers
2 later
2303.11249 (2023-03)
What Makes Data Suitable for a Locally Connected Neural Network? A Necessary and Sufficient Condition Based on Quantum Entanglement
2310.02980 (2023-10)
Never Train from Scratch: Fair Comparison of Long-Sequence Models Requires Data-Driven Priors
batched_bincount
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention
batched_index_select
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention
cast_tuple 1 other paper
1 dated earlier
2002.05202 (2020-02)
GLU Variants Improve Transformer
default
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2002.05202 (2020-02)
GLU Variants Improve Transformer
distribution
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention
dists_and_buckets
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention
scatter_mean
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention
similarity
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention
split_at_index
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2105.14850 (2021-05)
Cascaded Head-colliding Attention

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

Group activity recognition is a crucial yet challenging problem, whose core lies in fully exploring spatial-temporal interactions among individuals and generating reasonable group representations. However, previous methods either model spatial and temporal information separately, or directly aggregate individual features to form group features. To address these issues, we propose a novel group activity recognition network termed GroupFormer. It captures spatial-temporal contextual information jointly to augment the individual and group representations effectively with a clustered spatial-temporal transformer. Specifically, our GroupFormer has three appealing advantages: (1) A tailormodified Transformer, Clustered Spatial-Temporal Transformer, is proposed to enhance the individual representation and group representation. (2) It models the spatial and temporal dependencies integrally and utilizes decoders to build the bridge between the spatial and temporal information. (3) A clustered attention mechanism is utilized to dynamically divide individuals into multiple clusters for better learning activity-aware semantic representations. Moreover, experimental results show that the proposed framework outperforms state-of-the-art methods on the Volleyball dataset and Collective Activity dataset. Code is available at https://github.com/xueyee/GroupFormer * indicates equal contribution. † denotes corresponding author.

For agents

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

get_harvested_code_for_paper("2108.12630")
get_code_for_paper("2108.12630")
have("2108.12630")

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

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

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

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

Connect an agent — have() is free.