| CAA |
Ran ran on a synthesized input · constructed an object; no result was computed |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("74a5048f7a3f2172") How it ranRan 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, CAA: 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)
# Define the CAA module exactly as provided
class CAA(nn.Module):
def __init__(self, num_nodes: int, in_dim: int, win_len: int, num_patterns: int=8, d_model: int=64, d_affine: int=32):
super().__init__()
self.N = num_nodes
self.C = in_dim
self.S = win_len
self.P = num_patterns
self.d = d_model
self.dA = d_affine
self.pattern_keys = nn.Parameter(torch.randn(self.P, self.S) * 0.01)
self.seq_embed = nn.Linear(self.S, self.d, bias=True)
self.key_embed = nn.Linear(self.S, self.d, bias=True)
self.value_embed = nn.Linear(self.S, self.d, bias=True)
self.row_proj = nn.Linear(self.d, self.dA, bias=True)
self.col_emb = nn.Parameter(torch.randn(self.N, self.dA) * 0.01)
self.scale = nn.Parameter(torch.zeros(1))
self.attn_drop = nn.Dropout(0.0)
self.proj_drop = nn.Dropout(0.0)
self.eps = 1e-06
def _zscore_last(self, x: torch.Tensor) -> torch.Tensor:
mean = x.mean(dim=-1, keepdim=True)
std = x.std(dim=-1, keepdim=True).clamp_min(self.eps)
return (x - mean) / std
def forward(self, x_node: torch.Tensor) -> torch.Tensor:
B, C, N, T = x_node.shape
assert C == self.C and N == self.N and (T >= self.S)
if self.scale.item() == 0.0:
return x_node.new_zeros((B, N, N))
x_tail = x_node[..., -self.S:]
x_win = x_tail[:, 1, :, :]
x_win = self._zscore_last(x_win)
q = self.seq_embed(x_win)
k = self.key_embed(self.pattern_keys)
v = self.value_embed(self.pattern_keys)
k = k.unsqueeze(0).expand(B, -1, -1)
v = v.unsqueeze(0).expand(B, -1, -1)
attn_scores = torch.matmul(q, k.transpose(1, 2)) / self.d ** 0.5
attn = torch.nn.functional.softmax(attn_scores, dim=-1)
attn = self.attn_drop(attn)
h = torch.matmul(attn, v)
h = self.proj_drop(h)
row = self.row_proj(h)
delta = torch.einsum('bid,jd->bij', row, self.col_emb)
return self.scale * delta
# Set up test parameters
num_nodes = 3
in_dim = 2
win_len = 5
num_patterns = 4
d_model = 8
d_affine = 4
# Create an instance to verify it works
caa_module = CAA(
num_nodes=num_nodes,
in_dim=in_dim,
win_len=win_len,
num_patterns=num_patterns,
d_model=d_model,
d_affine=d_affine
)
# Create dummy input tensor
# Shape: (B, C, N, T) = (batch_size, in_dim, num_nodes, time_steps)
B = 2
T = 10
x_node = torch.randn(B, in_dim, num_nodes, T)
# Build arguments dict
ARGS = {
'num_nodes': num_nodes,
'in_dim': in_dim,
'win_len': win_len,
'num_patterns': num_patterns,
'd_model': d_model,
'd_affine': d_affine
}
- 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 CAA — 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 CAA 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
|
| FMF |
Ran ran on a synthesized input · constructed an object; no result was computed |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("15e123c43e4da9f7") How it ranRan 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, FMF: 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)
# Create a minimal FMF instance first
fmf_instance = nn.Module()
# Define all arguments for FMF.__init__
ARGS = {
'adaptive_thresholds': True,
'qI': 0.1,
'qB': 0.2,
'qG': 0.2,
'qZR': 0.9,
'ema_beta': 0.9,
'i_eps_min': 1e-08,
'b_thr_min': 0.002,
'g_thr_min': 0.002,
'qzr_min': 0.7,
'qzr_max': 0.98,
'zi_scale': 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 FMF — 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 FMF 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
|
| SPE |
Ran ran on a synthesized input · constructed an object; no result was computed |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("c1e3868dffb9df1e") How it ranRan 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, SPE: 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)
# Build minimal stand-in classes and modules for dependencies
class MinimalGCN(nn.Module):
def __init__(self, c_in, c_out, dropout, support_len=2, order=1):
super().__init__()
self.mlp = nn.Conv2d(order * support_len * c_in, c_out, kernel_size=1)
self.dropout = dropout
def forward(self, x, support):
return self.mlp(x)
class MinimalTCN(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, dilation, dropout):
super().__init__()
self.conv = nn.Conv2d(
in_channels,
out_channels,
kernel_size=(kernel_size, 1),
padding=(dilation * (kernel_size - 1), 0),
dilation=(dilation, 1)
)
self.dropout = nn.Dropout(dropout)
def forward(self, x):
return self.dropout(self.conv(x))
class MinimalEnd(nn.Module):
def __init__(self, skip_channels, end_channels, out_len):
super().__init__()
self.conv1 = nn.Conv2d(skip_channels, end_channels, kernel_size=1)
self.conv2 = nn.Conv2d(end_channels, out_len, kernel_size=1)
def forward(self, x):
x = self.conv1(x)
x = self.conv2(x)
return x
# Build the minimal SPE module that would satisfy typical usage
class MinimalSPE(nn.Module):
def __init__(self, num_nodes, dropout, in_dim, out_len, residual_channels,
dilation_channels, skip_channels, end_channels, kernel_size, blocks, layers):
super().__init__()
self.num_nodes = num_nodes
self.dropout = dropout
self.in_dim = in_dim
self.out_len = out_len
self.residual_channels = residual_channels
self.dilation_channels = dilation_channels
self.skip_channels = skip_channels
self.end_channels = end_channels
self.kernel_size = kernel_size
self.blocks = blocks
self.layers = layers
# Minimal start conv
self.start_conv = nn.Conv2d(in_dim, residual_channels, kernel_size=1)
# Minimal TCN layers
self.tcn_layers = nn.ModuleList()
for b in range(blocks):
for l in range(layers):
dilation = 2 ** l
tcn = MinimalTCN(residual_channels, dilation_channels, kernel_size, dilation, dropout)
self.tcn_layers.append(tcn)
# Minimal GCN
self.gcn = MinimalGCN(dilation_channels, skip_channels, dropout)
# Minimal spatial attention
self.spatial_attention = SpatialAttentionEnhanceBlock(
num_nodes=num_nodes,
channels=skip_channels,
heads=4,
tau=1.0,
attn_dropout=dropout,
proj_dropout=dropout
)
# End layer
self.end = MinimalEnd(skip_channels, end_channels, out_len)
def forward(self, x, support):
x = self.start_conv(x)
skip = 0
for tcn_layer in self.tcn_layers:
x = tcn_layer(x)
skip = skip + x if isinstance(skip, torch.Tensor) else x
x = self.gcn(skip, support)
x = self.spatial_attention(x)
x = self.end(x)
return x
# Define arguments for SPE
ARGS = {
'num_nodes': 4,
'dropout': 0.1,
'in_dim': 2,
'out_len': 3,
'residual_channels': 8,
'dilation_channels': 8,
'skip_channels': 8,
'end_channels': 8,
'kernel_size': 3,
'blocks': 1,
'layers': 2
}
- 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 SPE — 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 SPE 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
|
| SpatialAttentionEnhanceBlock |
Ran ran on a synthesized input · constructed an object; no result was computed |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("862efb13fda43fa9") How it ranRan 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, SpatialAttentionEnhanceBlock: 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 SpatialAttentionEnhanceBlock(nn.Module):
def __init__(self, num_nodes: int, channels: int, heads: int=4, tau: float=1.0, attn_dropout: float=0.0, proj_dropout: float=0.0, fusion_mode: str='conv', gate_type: str='scalar', symmetrize: bool=True, normalize: str='softmax', eps: float=1e-06):
super().__init__()
assert channels % heads == 0
assert fusion_mode in ('conv', 'gate')
assert normalize in ('softmax', 'row')
self.num_nodes = num_nodes
self.channels = channels
self.heads = heads
self.dk = channels // heads
self.scale = self.dk ** 0.5 * max(tau, 1e-06)
self.symmetrize = symmetrize
self.normalize = normalize
self.eps = eps
self.q_linear = nn.Conv2d(channels, channels, kernel_size=1, bias=False)
self.k_linear = nn.Conv2d(channels, channels, kernel_size=1, bias=False)
self.attn_drop = nn.Dropout(attn_dropout)
self.proj_drop = nn.Dropout(proj_dropout)
self.structural_attn = nn.Parameter(torch.eye(num_nodes), requires_grad=True)
self.fusion_mode = fusion_mode
if fusion_mode == 'conv':
self.fusion = nn.Conv2d(2, 1, kernel_size=1, bias=True)
else:
if gate_type == 'scalar':
self.gate = nn.Parameter(torch.tensor(0.0))
elif gate_type == 'vector':
self.gate = nn.Parameter(torch.zeros(num_nodes))
else:
raise ValueError("gate_type must be 'scalar' or 'vector'")
self.gate_type = gate_type
self.softmax_last = nn.Softmax(dim=-1)
def _row_normalize(self, A: torch.Tensor) -> torch.Tensor:
denom = A.sum(-1, keepdim=True).clamp_min(self.eps)
return A / denom
def forward(self, x: torch.Tensor) -> torch.Tensor:
B, C, N, T = x.size()
assert N == self.num_nodes and C == self.channels
Q = self.q_linear(x)
K = self.k_linear(x)
Q_ = Q.permute(0, 3, 2, 1).contiguous().view(B * T, N, self.heads, self.dk).permute(0, 2, 1, 3)
K_ = K.permute(0, 3, 2, 1).contiguous().view(B * T, N, self.heads, self.dk).permute(0, 2, 1, 3)
att_scores = torch.matmul(Q_, K_.transpose(-1, -2)) / self.scale
att_node = torch.nn.functional.softmax(att_scores, dim=-1)
att_node = self.attn_drop(att_node)
att_node = att_node.view(B, T, self.heads, N, N).mean(dim=(1, 2))
att_struct = torch.nn.functional.softmax(self.structural_attn, dim=-1).unsqueeze(0).expand(B, -1, -1)
if self.fusion_mode == 'conv':
fusion_input = torch.stack([att_node, att_struct], dim=1)
fused = self.fusion(fusion_input).squeeze(1)
elif self.gate_type == 'scalar':
g = torch.sigmoid(self.gate)
fused = g * att_node + (1.0 - g) * att_struct
else:
g_vec = torch.sigmoid(self.gate)
g = g_vec.view(1, N, 1)
fused = g * att_node + (1.0 - g) * att_struct
if self.symmetrize:
fused = 0.5 * (fused + fused.transpose(1, 2))
if self.normalize == 'softmax':
fused = torch.nn.functional.softmax(fused, dim=-1)
else:
fused = self._row_normalize(fused)
fused = self.attn_drop(fused)
x_bt = x.permute(0, 3, 2, 1)
x_att = torch.einsum('bij,btjc->btic', fused, x_bt)
x_att = self.proj_drop(x_att)
x_out = x_att.permute(0, 3, 2, 1).contiguous()
return x_out
ARGS = {
'num_nodes': 3,
'channels': 4,
'heads': 2,
'tau': 1.0,
'attn_dropout': 0.1,
'proj_dropout': 0.1,
'fusion_mode': 'conv',
'gate_type': 'scalar',
'symmetrize': True,
'normalize': 'softmax',
'eps': 1e-06
}
- 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 SpatialAttentionEnhanceBlock — 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 SpatialAttentionEnhanceBlock 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
|
| gcn |
Ran ran on a synthesized input · constructed an object; no result was computed |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("097b1661909d59a6") How it ranRan 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, gcn: 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)
# Build the gcn module and its dependencies
class linear(nn.Module):
def __init__(self, c_in, c_out):
super(linear, self).__init__()
self.mlp = nn.Conv2d(c_in, c_out, kernel_size=1)
def forward(self, x):
return self.mlp(x)
class nconv(nn.Module):
def __init__(self):
super(nconv, self).__init__()
def forward(self, x, A):
if len(A.shape) == 2:
x = torch.einsum('vw, ncwl->ncvl', A, x)
else:
x = torch.einsum('nvw, ncwl->ncvl', A, x)
return x.contiguous()
class gcn(nn.Module):
def __init__(self, c_in, c_out, dropout, support_len=2, order=1):
super(gcn, self).__init__()
self.nconv = nconv()
c_in = order * support_len * c_in
self.mlp = linear(c_in, c_out)
self.dropout = dropout
self.order = order
def forward(self, x, support):
out = []
for a in support:
x1 = self.nconv(x, a)
out.append(x1)
for k in range(2, self.order + 1):
x2 = self.nconv(x1, a)
out.append(x2)
x1 = x2
h = torch.cat(out, dim=1)
h = self.mlp(h)
return torch.nn.functional.dropout(h, self.dropout, training=self.training)
# Create test data
# x shape: (batch, channels, nodes, time_steps)
batch_size = 2
num_nodes = 3
num_channels = 4
time_steps = 5
x = torch.randn(batch_size, num_channels, num_nodes, time_steps)
# support is a list of adjacency matrices
# Each can be either 2D (static) or 3D (dynamic with batch)
support = [
torch.randn(num_nodes, num_nodes), # static adjacency matrix
torch.randn(num_nodes, num_nodes), # another static adjacency matrix
]
ARGS = {
'c_in': num_channels,
'c_out': 8,
'dropout': 0.5,
'support_len': len(support),
'order': 1,
}
- 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 gcn — 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 gcn 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
|
| linear |
Ran ran on a synthesized input · constructed an object; no result was computed |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("93ec574d0aec4e98") How it ranRan 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, linear: 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 = {
'c_in': 3,
'c_out': 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 linear — 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 linear 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
|
| nconv |
Ran ran on a synthesized input |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("8a98ee8ff4650081") How it ranRan 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 4, 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
from scipy import sparse
INIT_ARGS = {}
ARGS = {
'x': torch.randn(2, 4, 3, 5), # (batch, channels, nodes, sequence_length)
'A': torch.randn(3, 3) # adjacency matrix (nodes, nodes)
}
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, scipy, 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 — 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)
|
| stoep |
Not yet run unverified (harvested, no recorded run) |
stdi-lab/STOEP/model/STOEP.py code served (permissive licence) · get_code("80ea847088e09a61") How it ran |