| batch_mm |
Ran ran on a synthesized input |
ocadni/annfore/annfore/models/common.py code served (permissive licence) · get_code("88a25afdb229a4de") 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 Tensor, ndim 3, dtype family float, shape (2, 5, 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)
# Construct arguments for batch_mm
# matrix: Sparse or dense matrix, size (m, n)
# matrix_batch: Batched dense matrices, size (b, n, k)
# Let's use:
# m = 5 (output rows)
# n = 4 (shared dimension)
# k = 3 (output columns)
# b = 2 (batch size)
m, n, k, b = 5, 4, 3, 2
# Create a dense matrix of size (m, n) = (5, 4)
matrix = torch.randn(m, n)
# Create batched dense matrices of size (b, n, k) = (2, 4, 3)
matrix_batch = torch.randn(b, n, k)
ARGS = {
"matrix": matrix,
"matrix_batch": matrix_batch,
}
- 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, 5, 3) — shape (2, 5, 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
|
| calc_avg_states |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/l_utils.py code served (permissive licence) · get_code("e46492b8d6cb0304") 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 tuple, 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
torch.manual_seed(0)
# The function expects:
# - samples: a tensor with shape (batch, time, spatial, features)
# where it indexes samples[:, T, :, 0], samples[:, T, :, 1], samples[:, T, :, 2]
# So we need at least 3 feature channels (S, I, R)
# - T: an integer time index (default 0)
# Create a small samples tensor
# Shape: (batch_size=2, time_steps=5, spatial_dim=4, features=3)
samples = torch.randn(2, 5, 4, 3)
# T is already defaulted to 0 in the function, but we can specify it
T = 0
ARGS = {
"samples": samples,
"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 tuple, ndim 2, 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
|
| calc_feat_power |
Ran ran on a synthesized input |
ocadni/annfore/annfore/net/deep_linear.py code served (permissive licence) · get_code("f32d4ccb471ff352") 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 list, 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 numpy as np
ARGS = {
"dim_input": 100,
"out_count": 10,
"nlay": 5,
"power": 2
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family int — 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
|
| format_src_print |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/l_utils.py code served (permissive licence) · get_code("8e6aaa40cc72bcbb") 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 str. 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 numpy as np
torch.manual_seed(0)
# The function format_src_print accepts a single parameter 'sourc'
# It can handle: torch.Tensor, np.ndarray, or list-like objects
# The function indexes x[i] and accesses x[i][0] and x[i][1], suggesting 2D array
# x.shape[0] is used, so we need a 2D structure with at least 1 row
# Create a small 2D numpy array (2 rows, 2 columns for the unpacking)
sourc_numpy = np.array([[5, 0.123], [3, 0.456]])
ARGS = {
"sourc": sourc_numpy
}
- 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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
|
| logP |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/train_params.py code served (permissive licence) · get_code("db96eb179ca980fe") 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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
class EnergyModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 1)
def energy(self, x):
return self.linear(x).squeeze(-1)
model = EnergyModel()
x = torch.randn(2, 4)
ARGS = {
"model": model,
"x": x
}
- 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 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
|
| logP_logQ |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/train_params.py code served (permissive licence) · get_code("33352cf70ab668d7") 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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 1)
self.extra_params = {'max_Z': -200.0}
def energy(self, x):
return self.linear(x).squeeze(-1)
model = SimpleModel()
x = torch.randn(2, 4)
log_q_x = torch.randn(2)
baseline_norm = -200
ARGS = {
'model': model,
'x': x,
'log_q_x': log_q_x,
'baseline_norm': baseline_norm
}
- 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 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
|
| loss_fn |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/losses.py code served (permissive licence) · get_code("8260a897032b015e") 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 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
import time
torch.manual_seed(0)
# Capability enum
class Capabil:
ENERGY_SEP = "energy_separated"
# Minimal net model that satisfies the function's usage
class MinimalNet(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def sample(self, num_samples):
# Returns (samples, probs)
samples = torch.randn(num_samples, 4)
probs = torch.ones(num_samples, 4) * 0.25
return samples, probs
def __call__(self, samples):
# Returns log probabilities
return torch.ones(samples.shape[0], samples.shape[1]) * -1.386
def _log_prob(self, samples, probs):
# Returns log probability per sample
return torch.sum(torch.log(probs + 1e-8), dim=1)
def transform_samples(self, samples):
# Identity transform
return samples
# Minimal model that provides energy computation
class MinimalEnergyModel(nn.Module):
def __init__(self, separate_energies=True):
super().__init__()
self.linear = nn.Linear(4, 1)
self.separate_energies = separate_energies
self._capabilities = set()
if separate_energies:
self._capabilities.add(Capabil.ENERGY_SEP)
def get_capabilities(self):
return self._capabilities
def energy_separated(self, samples):
# Returns 4 energy tensors (one per ENERGIES_NAMES entry)
batch_size = samples.shape[0]
e1 = torch.randn(batch_size)
e2 = torch.randn(batch_size)
e3 = torch.randn(batch_size)
e4 = torch.randn(batch_size)
return [e1, e2, e3, e4]
def energy_(self, samples):
# Returns single energy tensor
batch_size = samples.shape[0]
return torch.randn(batch_size)
# Build minimal instances
net = MinimalNet()
model = MinimalEnergyModel(separate_energies=True)
beta = 1.0
ARGS = {
'net': net,
'model': model,
'beta': beta,
'rerun_probs': 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 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
|
| loss_fn_coeff |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/losses.py code served (permissive licence) · get_code("a7f1d520148c4025") 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 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
import time
torch.manual_seed(0)
# Define Capabil enum or class for capabilities
class Capabil:
ENERGY_SEP = "energy_separated"
# Define a minimal net model that implements required methods
class MinimalNet(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 3)
def sample(self, num_samples):
# Returns (samples, probs)
samples = torch.randn(num_samples, 4)
probs = torch.softmax(self.linear(samples), dim=-1)
return samples, probs
def _log_prob(self, samples, probs):
# Return log probabilities for samples
return torch.sum(torch.log(probs + 1e-8), dim=-1)
def transform_samples(self, samples):
# Transform samples (identity in minimal case)
return samples
# Define a minimal model that implements energy methods
class MinimalEnergyModel(nn.Module):
def __init__(self, has_separated=True):
super().__init__()
self.linear = nn.Linear(4, 1)
self.has_separated = has_separated
self._capabilities = [Capabil.ENERGY_SEP] if has_separated else []
def get_capabilities(self):
return self._capabilities
def energy_separated(self, samples):
# Return 4 separate energy tensors for ENERGIES_NAMES
energy = self.linear(samples).squeeze(-1)
return [
energy.abs(),
energy.abs() * 0.5,
energy.abs() * 0.3,
energy.abs() * 0.2
]
def energy_(self, samples):
# Return combined energy
energy = self.linear(samples).squeeze(-1)
return energy.abs()
# Create instances
net = MinimalNet()
model = MinimalEnergyModel(has_separated=True)
beta = 0.5
ARGS = {
'net': net,
'model': model,
'beta': beta
}
- 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
|
| loss_fn_coeff_p_sus |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/losses.py code served (permissive licence) · get_code("22fae26097751c91") 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 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
import time
torch.manual_seed(0)
# Create a mock network that implements the required methods
class MockNet(nn.Module):
def __init__(self, sample_dim=4, latent_dim=3):
super().__init__()
self.sample_dim = sample_dim
self.latent_dim = latent_dim
self.linear = nn.Linear(latent_dim, sample_dim)
def sample(self, num_samples):
# Returns (samples, probs)
samples = torch.randn(num_samples, self.sample_dim)
probs = torch.rand(num_samples, self.sample_dim)
return samples, probs
def _log_prob(self, samples, probs):
# Returns log probability for each sample
return torch.randn(samples.shape[0])
def transform_samples(self, samples):
# Identity transform for simplicity
return samples
# Create a mock model that implements energy_separated
class MockModel(nn.Module):
def __init__(self, sample_dim=4):
super().__init__()
self.sample_dim = sample_dim
def energy_separated(self, samples):
# Returns tuple of 4 energy tensors (ener_mc, ener_obs, ener_sources, ener_p_sus)
batch_size = samples.shape[0]
ener_mc = torch.randn(batch_size)
ener_obs = torch.randn(batch_size)
ener_sources = torch.randn(batch_size)
ener_p_sus = torch.randn(batch_size)
return (ener_mc, ener_obs, ener_sources, ener_p_sus)
# Create instances
net = MockNet(sample_dim=4, latent_dim=3)
model = MockModel(sample_dim=4)
# Define beta parameter
beta = 0.5
# Optional fun_beta_inv parameter
def fun_beta_inv(b):
return 1.0 - b
ARGS = {
'net': net,
'model': model,
'beta': beta,
'fun_beta_inv': fun_beta_inv
}
- 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
|
| make_lin_layers |
Ran ran on a synthesized input |
ocadni/annfore/annfore/net/deep_linear.py code served (permissive licence) · get_code("70402e4f401c4103") 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 list, ndim 1, 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)
# Create simple activation functions to use as in_func and last_func
in_func = nn.ReLU()
last_func = nn.Sigmoid()
# Define the features list - this determines layer dimensions
# The function iterates through features[:-1] and connects each to the next
# So features = [3, 5] means: input layer with 3 features, output layer with 5 features
features = [3, 5]
# bias parameter
bias = True
ARGS = {
'features': features,
'in_func': in_func,
'last_func': last_func,
'bias': bias
}
- 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 1, 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
|
| make_masks |
Ran ran on a synthesized input |
ocadni/annfore/annfore/net/nn_sir_path_obs.py code served (permissive licence) · get_code("88747e21714a2d36") 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 ndarray, ndim 3, dtype family float, shape (5, 2, 8) 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 numpy as np
# Construct observations list
# Each observation is [node_index, value, time]
# value: 0 (susceptible), 1 (infected), 2 (recovered)
observ = [
[0, 0, 1], # node 0, susceptible at time 1
[1, 1, 2], # node 1, infected at time 2
[2, 2, 3], # node 2, recovered at time 3
]
# Parameters
n = 5 # number of nodes
T = 7 # number of time steps (times range from 0 to T inclusive)
ARGS = {
"observ": observ,
"n": n,
"T": T,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 3, dtype family float, shape (5, 2, 8) — shape (5, 2, 8) 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
|
| make_opt |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/opt.py code served (permissive licence) · get_code("f4f47a0dd89c33fc") 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 Adam. 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 simple neural network with parameters
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 3)
def forward(self, x):
return self.linear(x)
model = SimpleModel()
params = model.parameters()
ARGS = {
'params': params,
'lr': 0.001,
'opt': 'adam',
'alpha': 0.99,
'momentum': 0.9,
'betas': (0.9, 0.999),
'weight_decay': 0
}
- 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 Adam — a Adam output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Adam 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
|
| my_linear |
Ran ran on a synthesized input |
ocadni/annfore/annfore/net/deep_linear.py code served (permissive licence) · get_code("30a691fc43d7825e") 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 Linear. 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.nn.parameter import Parameter
from torch.nn import init
torch.manual_seed(0)
class ZeroLinear(nn.Module):
def __init__(self, out_features, bias):
super(ZeroLinear, self).__init__()
self.out_features = out_features
self.in_features = 0
if bias:
self.bias = Parameter(torch.Tensor(out_features))
self.has_bias = True
else:
self.bias = torch.zeros(out_features)
self.has_bias = False
self.reset_parameters()
def reset_parameters(self, rang=0.1):
if self.has_bias:
init.uniform_(self.bias, -rang, rang)
def forward(self, x):
return self.bias.repeat(x.shape[0], 1)
def extra_repr(self):
return 'in_features=0, out_features={}, bias={}'.format(self.out_features, self.bias is not None)
def my_linear(in_feat, out_feat, bias):
if in_feat > 0:
return nn.Linear(in_feat, out_feat, bias)
else:
return ZeroLinear(out_feat, bias)
ARGS = {
"in_feat": 5,
"out_feat": 3,
"bias": True
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Linear — a Linear output has no array shape of its own; none 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
|
| normalize |
Ran ran on a synthesized input |
ocadni/annfore/annfore/models/sir_model_sep.py code served (permissive licence) · get_code("90ce614d4b6b5793") 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 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)
# The function normalize takes a tensor and an optional dim parameter
# It calls .float() and .sum() on the tensor
# So we need a real torch tensor
tensor = torch.tensor([[1, 2, 3, 4],
[5, 6, 7, 8]], dtype=torch.int32)
ARGS = {
"tensor": tensor,
"dim": 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 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
|
| one_hot_conf_from_times |
Ran ran on a synthesized input |
ocadni/annfore/annfore/utils/conf_utils.py code served (permissive licence) · get_code("23f65953c94eee38") 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 Tensor, ndim 4, dtype family float, shape (2, 4, 5, 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)
# x is a 3D tensor with shape (batch, nodes, 2)
# where the last dimension contains [infection_time, recovery_time]
# T is the number of time steps
batch_size = 2
num_nodes = 4
num_time_steps = 5
x = torch.tensor([
[[1.0, 3.0], [0.0, 2.0], [2.0, 4.0], [1.0, 1.5]],
[[0.0, 2.0], [1.0, 3.0], [0.5, 2.5], [2.0, 3.0]]
], dtype=torch.float32)
T = num_time_steps
ARGS = {
"x": x,
"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 Tensor, ndim 4, dtype family float, shape (2, 4, 5, 3) — shape (2, 4, 5, 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
|
| one_hot_samples |
Ran ran on a synthesized input |
ocadni/annfore/annfore/utils/conf_utils.py code served (permissive licence) · get_code("3eb2444e97ae7693") 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 Tensor, ndim 4, dtype family float, shape (2, 4, 5, 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)
# Construct minimal valid arguments for one_hot_samples
# The function expects:
# - x: tensor of shape (batch_size, num_features, 2) where x[:, :, 0] is t_i and x[:, :, 1] is t_r
# - T: integer representing number of time steps
# - q: integer representing number of one-hot classes (default 3)
batch_size = 2
num_features = 4
x = torch.randn(batch_size, num_features, 2)
T = 5
q = 3
ARGS = {
"x": x,
"T": T,
"q": q,
}
- 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, 4, 5, 3) — shape (2, 4, 5, 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
|
| one_hot_samples_relative_r |
Ran ran on a synthesized input |
ocadni/annfore/annfore/utils/conf_utils.py code served (permissive licence) · get_code("b326d2cdb16132fc") 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 Tensor, ndim 4, dtype family float, shape (2, 4, 5, 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)
# Analyze the function:
# - x: tensor with shape (batch, dim, 2) where x[:,:,0] is t_i and x[:,:,1] is t_r
# - T: integer for time dimension
# - q: integer for number of one-hot categories (default 3)
# - Returns tensor of shape (batch, dim, T, q)
batch_size = 2
dim = 4
T = 5
q = 3
# Create x tensor with shape (batch_size, dim, 2)
# x[:, :, 0] contains t_i (initial times)
# x[:, :, 1] contains t_r (relative times/durations)
x = torch.randint(0, T, (batch_size, dim, 2), dtype=torch.float32)
ARGS = {
'x': x,
'T': T,
'q': q,
}
- 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, 4, 5, 3) — shape (2, 4, 5, 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
|
| sample_avg_states |
Ran ran on a synthesized input |
ocadni/annfore/annfore/learn/l_utils.py code served (permissive licence) · get_code("8de71585e15ab1b8") 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 tuple, 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)
class MockNet(nn.Module):
def __init__(self):
super().__init__()
def sample(self, sample_size):
# Returns (sample_raw, x_hat)
# sample_raw needs to be transformable by transform_samples
# Let's create a batch of samples
sample_raw = torch.randn(sample_size, 10, 3) # sample_size x time_steps x features
x_hat = torch.randn(sample_size, 3)
return sample_raw, x_hat
def transform_samples(self, sample_raw):
# Takes sample_raw and returns samples with shape (batch, time, spatial, state_dim)
# calc_avg_states expects samples[:, T, :, 0], samples[:, T, :, 1], samples[:, T, :, 2]
# So we need shape: (batch_size, time_steps, spatial_dims, 3)
batch_size = sample_raw.shape[0]
time_steps = sample_raw.shape[1]
# Create a 4D tensor: (batch, time, spatial, state_vars)
samples = torch.randn(batch_size, time_steps, 4, 3)
return samples
net = MockNet()
sample_size = 2
T = 0
ARGS = {
"sample_size": sample_size,
"net": net,
"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 tuple, ndim 2, 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
|
| transform_to_spins |
Ran ran on a synthesized input |
ocadni/annfore/annfore/models/sir_model_sep.py code served (permissive licence) · get_code("9fb5bf91b56bc932") 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 Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
torch.manual_seed(0)
# Create a small binary tensor (batch_size=2, dim=4)
bin_tensor = torch.tensor([
[0, 1, 0, 1],
[1, 0, 1, 0]
], dtype=torch.float32)
ARGS = {
'bin_tensor': bin_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 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
|
| calc_p_no_c_np |
Not yet run unverified (harvested, no recorded run) |
ocadni/annfore/annfore/models/common.py code served (permissive licence) · get_code("d30029f478a818ae") How it ran |
| check_convert_tensor |
Not yet run unverified (harvested, no recorded run) |
ocadni/annfore/annfore/models/common.py code served (permissive licence) · get_code("169404d17a6af306") How it ran |
| check_convert_tensor |
Not yet run unverified (harvested, no recorded run) |
ocadni/annfore/annfore/models/sir_model_sep.py code served (permissive licence) · get_code("7010edca19a563be") How it ran |
| get_linear_layers_path |
Not yet run unverified (harvested, no recorded run) |
ocadni/annfore/annfore/net/base.py code served (permissive licence) · get_code("5e93c65f419d5914") How it ran |
| opt_param_init |
Not yet run unverified (harvested, no recorded run) |
ocadni/annfore/annfore/learn/train_params.py code served (permissive licence) · get_code("25fc7691e23186cf") How it ran |