| BackboneBase |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("63d4c9530be04f79") 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, BackboneBase: 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
from torch import nn
import torch.nn.functional as F
from typing import Optional
torch.manual_seed(0)
class NestedTensor(object):
def __init__(self, tensors, mask: Optional[torch.Tensor]):
self.tensors = tensors
self.mask = mask
def to(self, device, non_blocking=False):
cast_tensor = self.tensors.to(device, non_blocking=non_blocking)
mask = self.mask
if mask is not None:
assert mask is not None
cast_mask = mask.to(device, non_blocking=non_blocking)
else:
cast_mask = None
return NestedTensor(cast_tensor, cast_mask)
def record_stream(self, *args, **kwargs):
self.tensors.record_stream(*args, **kwargs)
if self.mask is not None:
self.mask.record_stream(*args, **kwargs)
def decompose(self):
return (self.tensors, self.mask)
def __repr__(self):
return str(self.tensors)
class SimpleBackbone(nn.Module):
"""Minimal backbone with layer2, layer3, layer4 for IntermediateLayerGetter"""
def __init__(self):
super().__init__()
self.layer2 = nn.Sequential(
nn.Conv2d(3, 512, kernel_size=3, stride=2, padding=1),
nn.ReLU(inplace=True)
)
self.layer3 = nn.Sequential(
nn.Conv2d(512, 1024, kernel_size=3, stride=2, padding=1),
nn.ReLU(inplace=True)
)
self.layer4 = nn.Sequential(
nn.Conv2d(1024, 2048, kernel_size=3, stride=2, padding=1),
nn.ReLU(inplace=True)
)
def forward(self, x):
x = self.layer2(x)
x = self.layer3(x)
x = self.layer4(x)
return x
backbone = SimpleBackbone()
train_backbone = True
return_interm_layers = True
ARGS = {
'backbone': backbone,
'train_backbone': train_backbone,
'return_interm_layers': return_interm_layers
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BackboneBase — 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 BackboneBase 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
|
| DeformableTransformerDecoder |
Ran ran on a synthesized input |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("ab5760a4f1f38dd2") 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 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
from torch import nn
import copy
# We need to create a minimal decoder_layer that matches what DeformableTransformerDecoder expects
class MockDecoderLayer(nn.Module):
def __init__(self, d_model=8):
super().__init__()
self.d_model = d_model
self.linear = nn.Linear(d_model, d_model)
def forward(self, tgt, query_pos, reference_points_input, src, src_spatial_shapes, src_level_start_index, src_padding_mask):
# Simple pass-through with a linear transformation
return self.linear(tgt)
# Create the decoder layer
d_model = 8
decoder_layer = MockDecoderLayer(d_model=d_model)
INIT_ARGS = {
'decoder_layer': decoder_layer,
'num_layers': 2,
'return_intermediate': True
}
# Setup for forward pass
batch_size = 2
num_queries = 3
num_levels = 2
num_feature_points = 5
# tgt: decoder input queries [batch_size, num_queries, d_model]
tgt = torch.randn(batch_size, num_queries, d_model)
# reference_points: [batch_size, num_queries, 2] or [batch_size, num_queries, 4]
# Using 2D reference points
reference_points = torch.rand(batch_size, num_queries, 2)
# src: flattened multi-scale features [batch_size, sum(H_i*W_i), d_model]
src = torch.randn(batch_size, num_feature_points, d_model)
# src_spatial_shapes: [num_levels, 2] containing (H, W) for each level
src_spatial_shapes = torch.tensor([[2, 2], [1, 1]], dtype=torch.long)
# src_level_start_index: [num_levels] start index for each level in flattened src
src_level_start_index = torch.tensor([0, 4], dtype=torch.long)
# src_valid_ratios: [batch_size, num_levels, 2] valid ratios for each level
src_valid_ratios = torch.ones(batch_size, num_levels, 2)
# query_pos: positional embeddings for queries [batch_size, num_queries, d_model]
query_pos = torch.randn(batch_size, num_queries, d_model)
# src_padding_mask: [batch_size, sum(H_i*W_i)] mask for padded positions
src_padding_mask = torch.zeros(batch_size, num_feature_points, dtype=torch.bool)
ARGS = {
'tgt': tgt,
'reference_points': reference_points,
'src': src,
'src_spatial_shapes': src_spatial_shapes,
'src_level_start_index': src_level_start_index,
'src_valid_ratios': src_valid_ratios,
'query_pos': query_pos,
'src_padding_mask': src_padding_mask
}
- 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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| DeformableTransformerEncoder |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("a074eb87991640c4") 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, DeformableTransformerEncoder: 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
from torch import nn
import copy
torch.manual_seed(0)
# Create a minimal encoder layer that satisfies the interface used in forward()
class MinimalEncoderLayer(nn.Module):
def __init__(self, d_model=4):
super().__init__()
self.d_model = d_model
self.linear = nn.Linear(d_model, d_model)
def forward(self, src, pos, reference_points, spatial_shapes, level_start_index, padding_mask):
# The layer receives src and returns modified output
return self.linear(src)
# Create encoder layer instance
encoder_layer = MinimalEncoderLayer(d_model=4)
# Number of layers
num_layers = 2
# For forward() call, we need:
# src: tensor of shape (batch, seq_len, d_model)
batch_size = 2
seq_len = 8
d_model = 4
src = torch.randn(batch_size, seq_len, d_model)
# spatial_shapes: list of (H, W) tuples for each level
spatial_shapes = [(4, 2), (2, 2)] # 2 levels with different spatial dimensions
# level_start_index: indices where each level starts in the flattened sequence
level_start_index = torch.tensor([0, 8], dtype=torch.long)
# valid_ratios: tensor of shape (batch, num_levels, 2) for x,y ratios
num_levels = len(spatial_shapes)
valid_ratios = torch.ones(batch_size, num_levels, 2, dtype=torch.float32)
# pos: positional embeddings, same shape as src
pos = torch.randn(batch_size, seq_len, d_model)
# padding_mask: boolean mask of shape (batch, seq_len)
padding_mask = torch.zeros(batch_size, seq_len, dtype=torch.bool)
ARGS = {
'encoder_layer': encoder_layer,
'num_layers': num_layers,
}
- 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 DeformableTransformerEncoder — 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 DeformableTransformerEncoder 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
|
| FrozenBatchNorm2d |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("83acef54aa936437") 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, FrozenBatchNorm2d: 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
torch.manual_seed(0)
# FrozenBatchNorm2d takes two parameters: n (number of channels) and eps (epsilon)
# n: int - number of channels
# eps: float - small value for numerical stability (default 1e-05)
# Create a small example with 4 channels
n = 4
eps = 1e-05
ARGS = {
'n': n,
'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 FrozenBatchNorm2d — 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 FrozenBatchNorm2d 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
|
| Joiner |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("72ab0aab987d0596") 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, Joiner: 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
from typing import Optional, List
torch.manual_seed(0)
class SimpleBackbone(nn.Module):
def __init__(self):
super().__init__()
self.strides = [8, 16, 32]
self.num_channels = [64, 128, 256]
self.conv = nn.Conv2d(3, 64, kernel_size=3, padding=1)
def forward(self, nested_tensor):
xs = {}
xs['layer1'] = NestedTensor(
torch.randn(2, 64, 4, 3),
torch.ones(2, 4, 3, dtype=torch.bool)
)
xs['layer2'] = NestedTensor(
torch.randn(2, 128, 2, 2),
torch.ones(2, 2, 2, dtype=torch.bool)
)
xs['layer3'] = NestedTensor(
torch.randn(2, 256, 1, 1),
torch.ones(2, 1, 1, dtype=torch.bool)
)
return xs
class PositionEmbedding(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(10, 10)
def forward(self, nested_tensor):
batch, channels, height, width = nested_tensor.tensors.shape
pos_tensor = torch.randn(batch, channels, height, width)
return NestedTensor(
pos_tensor,
nested_tensor.mask
)
class NestedTensor(object):
def __init__(self, tensors, mask: Optional[torch.Tensor]):
self.tensors = tensors
self.mask = mask
def to(self, device, non_blocking=False):
cast_tensor = self.tensors.to(device, non_blocking=non_blocking)
mask = self.mask
if mask is not None:
assert mask is not None
cast_mask = mask.to(device, non_blocking=non_blocking)
else:
cast_mask = None
return NestedTensor(cast_tensor, cast_mask)
def record_stream(self, *args, **kwargs):
self.tensors.record_stream(*args, **kwargs)
if self.mask is not None:
self.mask.record_stream(*args, **kwargs)
def decompose(self):
return (self.tensors, self.mask)
def __repr__(self):
return str(self.tensors)
class Joiner(nn.Sequential):
def __init__(self, backbone, position_embedding):
super().__init__(backbone, position_embedding)
self.strides = backbone.strides
self.num_channels = backbone.num_channels
def forward(self, tensor_list: NestedTensor):
xs = self[0](tensor_list)
out: List[NestedTensor] = []
pos = []
for name, x in sorted(xs.items()):
out.append(x)
for x in out:
pos.append(self[1](x).to(x.tensors.dtype))
return (out, pos)
backbone = SimpleBackbone()
position_embedding = PositionEmbedding()
ARGS = {
'backbone': backbone,
'position_embedding': position_embedding
}
- 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 Joiner — 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 Joiner output the recorded ndim 1 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
|
| LSTMLikeSENet |
Ran ran on a synthesized input |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("a3406c64394db6f0") 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 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
from torch import nn
class LSTMLikeSENet(nn.Module):
def __init__(self, channel, r=16):
super().__init__()
self.sigmoid = nn.Sigmoid()
self.tanh = nn.Tanh()
self.w_z = nn.Linear(channel * 2, channel)
def forward(self, q, v):
b, n, d = q.shape
qv = torch.cat((q, v), dim=2)
z = self.sigmoid(self.w_z(qv))
h = (1 - z) * v + z * q
o = h
return o
INIT_ARGS = {
'channel': 4,
'r': 16,
}
ARGS = {
'q': torch.randn(2, 3, 4),
'v': torch.randn(2, 3, 4),
}
if __name__ == '__main__':
model = LSTMLikeSENet(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Expected shape: {ARGS['q'].shape}")
assert output.shape == ARGS['q'].shape, "Output shape mismatch"
print("Success!")
- 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)
|
| MSDeformAttn |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("fd3c89afd641c536") 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, MSDeformAttn: 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
from torch import nn
import math
torch.manual_seed(0)
def _is_power_of_2(n):
if not isinstance(n, int) or n < 0:
raise ValueError('invalid input for _is_power_of_2: {} (type: {})'.format(n, type(n)))
return n & n - 1 == 0 and n != 0
class MSDeformAttn(nn.Module):
def __init__(self, d_model=256, n_levels=4, n_heads=8, n_points=4):
"""
Multi-Scale Deformable Attention Module
:param d_model hidden dimension
:param n_levels number of feature levels
:param n_heads number of attention heads
:param n_points number of sampling points per attention head per feature level
"""
super().__init__()
if d_model % n_heads != 0:
raise ValueError('d_model must be divisible by n_heads, but got {} and {}'.format(d_model, n_heads))
_d_per_head = d_model // n_heads
if not _is_power_of_2(_d_per_head):
import warnings
warnings.warn("You'd better set d_model in MSDeformAttn to make the dimension of each attention head a power of 2 which is more efficient in our CUDA implementation.")
self.im2col_step = 64
self.d_model = d_model
self.n_levels = n_levels
self.n_heads = n_heads
self.n_points = n_points
self.sampling_offsets = nn.Linear(d_model, n_heads * n_levels * n_points * 2)
self.attention_weights = nn.Linear(d_model, n_heads * n_levels * n_points)
self.value_proj = nn.Linear(d_model, d_model)
self.output_proj = nn.Linear(d_model, d_model)
def forward(self, query, reference_points, input_flatten, input_spatial_shapes, input_level_start_index, input_padding_mask=None):
pass
# Setup arguments for MSDeformAttn instantiation
batch_size = 2
seq_len_query = 3
seq_len_input = 12
d_model = 8
n_levels = 2
n_heads = 2
n_points = 2
# query: (N, Length_{query}, C)
query = torch.randn(batch_size, seq_len_query, d_model)
# reference_points: (N, Length_{query}, n_levels, 2)
reference_points = torch.rand(batch_size, seq_len_query, n_levels, 2)
# input_flatten: (N, sum of all H_l * W_l, C)
input_flatten = torch.randn(batch_size, seq_len_input, d_model)
# input_spatial_shapes: (n_levels, 2) - heights and widths of each level
# For 2 levels with total flattened size of 12: could be (3, 2) and (2, 3)
input_spatial_shapes = torch.tensor([[3, 4], [2, 3]], dtype=torch.long)
# input_level_start_index: cumulative start indices
# Level 0 starts at 0, level 1 starts at 3*4=12
input_level_start_index = torch.tensor([0, 12], dtype=torch.long)
# input_padding_mask: (N, sum of H_l * W_l) - True for padding, False for non-padding
input_padding_mask = torch.zeros(batch_size, seq_len_input, dtype=torch.bool)
ARGS = {
'd_model': d_model,
'n_levels': n_levels,
'n_heads': n_heads,
'n_points': n_points,
}
- 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 MSDeformAttn — 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 MSDeformAttn 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
|
| OursDecoderLayerV2 |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("bea736025771555d") 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, OursDecoderLayerV2: 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 parameters for OursDecoderLayerV2
d_model = 4
nhead = 2
dim_feedforward = 8
dropout = 0.1
activation = 'relu'
normalize_before = False
# Create small tensors for the forward pass
batch_size = 2
seq_len = 3
tgt = torch.randn(seq_len, batch_size, d_model)
memory = torch.randn(seq_len, batch_size, d_model)
pos = torch.randn(seq_len, batch_size, d_model)
query_pos = torch.randn(seq_len, batch_size, d_model)
ARGS = {
'd_model': d_model,
'nhead': nhead,
'dim_feedforward': dim_feedforward,
'dropout': dropout,
'activation': activation,
'normalize_before': normalize_before,
}
- 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 OursDecoderLayerV2 — 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 OursDecoderLayerV2 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
|
| OursDecoderV2 |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("f1e72b80021df791") 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, OursDecoderV2: 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
from torch import Tensor
from typing import Optional
torch.manual_seed(0)
# Define the decoder layer
decoder_layer = nn.TransformerDecoderLayer(
d_model=256,
nhead=8,
dim_feedforward=2048,
dropout=0.1,
activation='relu',
batch_first=False
)
# Define a simple normalization layer
norm = nn.LayerNorm(256)
# Build the arguments dictionary
ARGS = {
'num_layers': 3,
'decoder_layer': decoder_layer,
'norm': norm,
'return_intermediate': 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 OursDecoderV2 — 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 OursDecoderV2 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
|
| PositionEmbeddingLearned |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("2e16cdcea17dfdc0") 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, PositionEmbeddingLearned: 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
from torch import nn
torch.manual_seed(0)
class NestedTensor(object):
def __init__(self, tensors, mask=None):
self.tensors = tensors
self.mask = mask
def to(self, device, non_blocking=False):
cast_tensor = self.tensors.to(device, non_blocking=non_blocking)
mask = self.mask
if mask is not None:
assert mask is not None
cast_mask = mask.to(device, non_blocking=non_blocking)
else:
cast_mask = None
return NestedTensor(cast_tensor, cast_mask)
def record_stream(self, *args, **kwargs):
self.tensors.record_stream(*args, **kwargs)
if self.mask is not None:
self.mask.record_stream(*args, **kwargs)
def decompose(self):
return (self.tensors, self.mask)
def __repr__(self):
return str(self.tensors)
# Create a tiny NestedTensor with batch_size=2, channels=4, height=3, width=5
x = torch.randn(2, 4, 3, 5)
mask = torch.zeros(2, 3, 5, dtype=torch.bool)
nested_tensor = NestedTensor(x, mask)
ARGS = {
"num_pos_feats": 256
}
- 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 PositionEmbeddingLearned — 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 PositionEmbeddingLearned 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
|
| PositionEmbeddingSine |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("747992503b5e8c6b") 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, PositionEmbeddingSine: 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
from torch import nn
import math
torch.manual_seed(0)
class NestedTensor(object):
def __init__(self, tensors, mask: torch.Tensor = None):
self.tensors = tensors
self.mask = mask
def to(self, device, non_blocking=False):
cast_tensor = self.tensors.to(device, non_blocking=non_blocking)
mask = self.mask
if mask is not None:
cast_mask = mask.to(device, non_blocking=non_blocking)
else:
cast_mask = None
return NestedTensor(cast_tensor, cast_mask)
def record_stream(self, *args, **kwargs):
self.tensors.record_stream(*args, **kwargs)
if self.mask is not None:
self.mask.record_stream(*args, **kwargs)
def decompose(self):
return (self.tensors, self.mask)
def __repr__(self):
return str(self.tensors)
# Create tiny test tensors: batch_size=2, height=3, width=4, channels=1
batch_size = 2
height = 3
width = 4
# Create a simple tensor (batch, channels, height, width)
x = torch.randn(batch_size, 1, height, width)
# Create a mask (batch, height, width) - False means valid, True means padding
mask = torch.zeros(batch_size, height, width, dtype=torch.bool)
# Create NestedTensor
tensor_list = NestedTensor(x, mask)
# Arguments for PositionEmbeddingSine
ARGS = {
'num_pos_feats': 64,
'temperature': 10000,
'normalize': False,
'scale': None
}
- 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 PositionEmbeddingSine — 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 PositionEmbeddingSine 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
|
| SimpleDecoderLayerV2 |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("5c57a6a5e5ed847a") 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, SimpleDecoderLayerV2: 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
from torch import Tensor
torch.manual_seed(0)
# Create arguments for SimpleDecoderLayerV2
d_model = 4
nhead = 2
dim_feedforward = 8
dropout = 0.1
activation = 'relu'
normalize_before = False
# Create the module
layer = nn.Module() # placeholder - will be replaced in actual call
# Create sample tensors for forward pass
# tgt shape: (seq_len, batch, d_model)
tgt = torch.randn(3, 2, d_model)
# memory shape: (seq_len, batch, d_model)
memory = torch.randn(5, 2, d_model)
# Optional positional embeddings
pos = torch.randn(5, 2, d_model)
query_pos = torch.randn(3, 2, d_model)
# Optional masks - None for basic case
tgt_mask = None
memory_mask = None
tgt_key_padding_mask = None
memory_key_padding_mask = None
ARGS = {
'd_model': d_model,
'nhead': nhead,
'dim_feedforward': dim_feedforward,
'dropout': dropout,
'activation': activation,
'normalize_before': normalize_before,
}
# Additional setup for forward pass (not part of __init__ but useful for testing)
FORWARD_ARGS = {
'tgt': tgt,
'memory': memory,
'tgt_mask': tgt_mask,
'memory_mask': memory_mask,
'tgt_key_padding_mask': tgt_key_padding_mask,
'memory_key_padding_mask': memory_key_padding_mask,
'pos': pos,
'query_pos': query_pos,
}
- 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 SimpleDecoderLayerV2 — 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 SimpleDecoderLayerV2 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
|
| SimpleDecoderV2 |
Ran ran on a synthesized input · constructed an object; no result was computed |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("91c2043c0d5cc3fb") 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, SimpleDecoderV2: 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
from torch import nn
torch.manual_seed(0)
# Create a SimpleDecoderLayerV2 instance for the decoder_layer parameter
decoder_layer = nn.Module()
decoder_layer.multihead_attn = nn.MultiheadAttention(256, 8, dropout=0.1)
decoder_layer.linear1 = nn.Linear(256, 2048)
decoder_layer.linear2 = nn.Linear(2048, 256)
decoder_layer.norm1 = nn.LayerNorm(256)
decoder_layer.norm2 = nn.LayerNorm(256)
decoder_layer.norm3 = nn.LayerNorm(256)
decoder_layer.dropout = nn.Dropout(0.1)
decoder_layer.dropout1 = nn.Dropout(0.1)
decoder_layer.dropout2 = nn.Dropout(0.1)
decoder_layer.dropout3 = nn.Dropout(0.1)
decoder_layer.activation = nn.functional.relu
decoder_layer.normalize_before = False
def with_pos_embed(tensor, pos=None):
return tensor if pos is None else tensor + pos
def forward_post(tgt, memory, tgt_mask=None, memory_mask=None, tgt_key_padding_mask=None, memory_key_padding_mask=None, pos=None, query_pos=None):
tgt2 = decoder_layer.multihead_attn(query=with_pos_embed(tgt, query_pos), key=with_pos_embed(memory, pos), value=memory, attn_mask=memory_mask, key_padding_mask=memory_key_padding_mask)[0]
tgt = tgt + decoder_layer.dropout2(tgt2)
tgt = decoder_layer.norm2(tgt)
tgt2 = decoder_layer.linear2(decoder_layer.dropout(nn.functional.relu(decoder_layer.linear1(tgt))))
tgt = tgt + decoder_layer.dropout3(tgt2)
tgt = decoder_layer.norm3(tgt)
return tgt
decoder_layer.forward_post = forward_post
decoder_layer.forward = forward_post
# Create a norm layer
norm_layer = nn.LayerNorm(256)
# Create arguments
ARGS = {
'num_layers': 2,
'decoder_layer': decoder_layer,
'norm': norm_layer,
'return_intermediate': 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 SimpleDecoderV2 — 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 SimpleDecoderV2 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
|
| build_position_encoding |
Ran ran; our contract draft was wrong, not the code |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("f2cdbc05e138fb89") 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 PositionEmbeddingSine. 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
from torch import nn
torch.manual_seed(0)
class MockConfig:
"""Minimal config object to satisfy build_position_encoding"""
def __init__(self, hidden_dim=128, position_embedding='sine'):
self.MODEL = type('obj', (object,), {
'hidden_dim': hidden_dim,
'position_embedding': position_embedding
})()
ARGS = {
'cfg': MockConfig(hidden_dim=128, position_embedding='sine')
}
- 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 PositionEmbeddingSine — a PositionEmbeddingSine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PositionEmbeddingSine 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
|
| Backbone |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("a211f6c6ab02ec90") How it ran |
| DeformableTransformerDecoderLayer |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("b9c992339536b95b") How it ran |
| DeformableTransformerEncoderLayer |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("4b89372abf4189ba") How it ran |
| PTSEFormer |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("b14eec9093b96e6d") How it ran |
| build_backbone |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("008eda08de0fc359") How it ran |
| build_deformable_decoder |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("952247bf85e628c6") How it ran |
| build_deformable_encoder |
Not yet run unverified (harvested, no recorded run) |
Hon-Wong/PTSEFormer/src/models/model_builder.py code served (permissive licence) · get_code("0e29dbaab3fc21bc") How it ran |