| SharedLISTABlock |
Ran ran on a synthesized input |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("1a5c7e05ed83096f") 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 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
@torch.no_grad()
def estimate_lipschitz(D: torch.Tensor, n_power_iter: int=10):
"""
Approximate ||D||_2^2.
Run power iteration with a fixed initial vector.
"""
K = D.shape[1]
v = torch.ones(K, device=D.device, dtype=D.dtype)
v = v / v.norm().clamp_min(1e-12)
for _ in range(n_power_iter):
v = D.t() @ (D @ v)
v = v / v.norm().clamp_min(1e-12)
Gv = D.t() @ (D @ v)
L = torch.dot(v, Gv).item()
return max(L, 1e-06)
def soft_threshold(v: torch.Tensor, thr):
return torch.sign(v) * torch.clamp(v.abs() - thr, min=0.0)
class SharedLISTABlock(nn.Module):
"""
One layer of shared-parameter LISTA.
The same parameters are used at every iteration because the weights are shared.
a^{t+1} = S_theta(Wx u + Wa a^t)
u is the input to this layer.
- x for the first layer
- the code from the immediately lower layer for subsequent layers
"""
def __init__(self, input_dim: int, code_dim: int, T: int=5):
super().__init__()
self.input_dim = input_dim
self.code_dim = code_dim
self.T = T
self.Wx = nn.Parameter(torch.empty(code_dim, input_dim))
self.Wa = nn.Parameter(torch.empty(code_dim, code_dim))
self.raw_theta = nn.Parameter(torch.zeros(code_dim))
self.reset_parameters()
def reset_parameters(self):
with torch.no_grad():
nn.init.xavier_uniform_(self.Wx)
self.Wa.zero_()
self.raw_theta.fill_(math.log(math.exp(0.1) - 1.0 + 1e-08))
@torch.no_grad()
def init_from_dictionary(self, D: torch.Tensor, lam: float, eta_scale: float=1.0):
"""
ISTA-style initialization:
Wx = eta D^T
Wa = I - eta D^T D
theta = eta * lam
"""
L = estimate_lipschitz(D)
eta = eta_scale / L
Dt = D.t()
G = Dt @ D
I = torch.eye(G.shape[0], device=D.device, dtype=D.dtype)
self.Wx.copy_(eta * Dt)
self.Wa.copy_(I - eta * G)
theta0 = eta * lam
raw_theta0 = math.log(math.exp(theta0) - 1.0 + 1e-08)
self.raw_theta.fill_(raw_theta0)
def forward(self, u: torch.Tensor):
batch_size = u.shape[0]
a = torch.zeros(batch_size, self.code_dim, device=u.device, dtype=u.dtype)
theta = F.softplus(self.raw_theta)
B = F.linear(u, self.Wx)
if self.T <= 0:
return a
a = soft_threshold(B, theta)
for _ in range(self.T - 1):
a = soft_threshold(B + F.linear(a, self.Wa), theta)
return a
INIT_ARGS = {
"input_dim": 4,
"code_dim": 3,
"T": 2,
}
ARGS = {
"u": torch.randn(2, 4),
}
if __name__ == "__main__":
block = SharedLISTABlock(**INIT_ARGS)
output = block(**ARGS)
print("Output shape:", output.shape)
print("Output:", output)
- 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 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| UntiedLISTABlock |
Ran ran on a synthesized input |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("c806aeee7160465d") 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 2, dtype family float, shape (2, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
@torch.no_grad()
def estimate_lipschitz(D: torch.Tensor, n_power_iter: int=10):
"""
Approximate ||D||_2^2.
Run power iteration with a fixed initial vector.
"""
K = D.shape[1]
v = torch.ones(K, device=D.device, dtype=D.dtype)
v = v / v.norm().clamp_min(1e-12)
for _ in range(n_power_iter):
v = D.t() @ (D @ v)
v = v / v.norm().clamp_min(1e-12)
Gv = D.t() @ (D @ v)
L = torch.dot(v, Gv).item()
return max(L, 1e-06)
def soft_threshold(v: torch.Tensor, thr):
return torch.sign(v) * torch.clamp(v.abs() - thr, min=0.0)
class UntiedLISTABlock(nn.Module):
"""
One layer of untied LISTA.
Each iteration has separate parameters.
a^{t+1} = S_{theta^(t)}( W_x^(t) u + W_a^(t) a^t )
"""
def __init__(self, input_dim: int, code_dim: int, T: int=5):
super().__init__()
self.input_dim = input_dim
self.code_dim = code_dim
self.T = T
self.Wx = nn.Parameter(torch.empty(T, code_dim, input_dim))
self.Wa = nn.Parameter(torch.empty(T, code_dim, code_dim))
self.raw_theta = nn.Parameter(torch.zeros(T, code_dim))
self.reset_parameters()
def reset_parameters(self):
with torch.no_grad():
for t in range(self.T):
nn.init.xavier_uniform_(self.Wx[t])
self.Wa[t].zero_()
self.raw_theta.fill_(math.log(math.exp(0.1) - 1.0 + 1e-08))
@torch.no_grad()
def init_from_dictionary(self, D: torch.Tensor, lam: float, eta_scale: float=1.0):
"""
Initialize all steps with the same ISTA-style values.
"""
L = estimate_lipschitz(D)
eta = eta_scale / L
Dt = D.t()
G = Dt @ D
I = torch.eye(G.shape[0], device=D.device, dtype=D.dtype)
Wx0 = eta * Dt
Wa0 = I - eta * G
theta0 = eta * lam
raw_theta0 = math.log(math.exp(theta0) - 1.0 + 1e-08)
for t in range(self.T):
self.Wx[t].copy_(Wx0)
self.Wa[t].copy_(Wa0)
self.raw_theta[t].fill_(raw_theta0)
def forward(self, u: torch.Tensor):
B = u.shape[0]
K = self.code_dim
a = torch.zeros(B, K, device=u.device, dtype=u.dtype)
theta = F.softplus(self.raw_theta)
for t in range(self.T):
z = F.linear(u, self.Wx[t]) + F.linear(a, self.Wa[t])
a = soft_threshold(z, theta[t])
return a
INIT_ARGS = {
'input_dim': 4,
'code_dim': 3,
'T': 2,
}
ARGS = {
'u': torch.randn(2, 4),
}
if __name__ == '__main__':
model = UntiedLISTABlock(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output: {output}")
- 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 2, dtype family float, shape (2, 3) — shape (2, 3) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| compute_hsc_gradients |
Ran ran; our contract draft was wrong, not the code |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("06287f5af3f369cc") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned list. 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)
# Construct arguments for compute_hsc_gradients
# The function computes gradients for a hierarchical sparse coding model
# Create a simple 2-layer hierarchical sparse coding setup
batch_size = 2
input_dim = 4
code_dim_0 = 3
code_dim_1 = 5
# x: input signal (batch_size, input_dim)
x = torch.randn(batch_size, input_dim)
# Ds: list of dictionary matrices
# D0: (input_dim, code_dim_0) - maps codes to input space
# D1: (code_dim_0, code_dim_1) - maps upper codes to lower code space
D0 = torch.randn(input_dim, code_dim_0)
D1 = torch.randn(code_dim_0, code_dim_1)
Ds = [D0, D1]
# codes: list of code matrices
# codes[0]: (batch_size, code_dim_0) - lower layer codes
# codes[1]: (batch_size, code_dim_1) - upper layer codes
codes = [
torch.randn(batch_size, code_dim_0),
torch.randn(batch_size, code_dim_1)
]
# betas: list of regularization weights for hierarchical coupling
# betas[0] couples layer 0 and layer 1
betas = [0.5]
ARGS = {
"x": x,
"Ds": Ds,
"codes": codes,
"betas": betas
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list — a list output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| compute_hsc_layer_steps |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("0d00a5aa1cb92012") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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
torch.manual_seed(0)
# Create small tensors for Ds
# Each D should be a 2D tensor that will be used in matrix operations
# D.shape[1] is used to get K (number of columns)
# D.t() @ (D @ v) is computed, so D should be (n_samples, n_features)
D0 = torch.randn(2, 4) # First layer: 2 samples, 4 features
D1 = torch.randn(3, 4) # Second layer: 3 samples, 4 features
D2 = torch.randn(2, 4) # Third layer: 2 samples, 4 features
Ds = [D0, D1, D2]
# betas should have length max(L - 1, 0) where L = len(Ds) = 3
# So betas should have length max(3 - 1, 0) = 2
betas = [0.5, 0.3]
# eta_scale is a float scaling factor
eta_scale = 1.0
ARGS = {
"Ds": Ds,
"betas": betas,
"eta_scale": eta_scale,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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
|
| estimate_lipschitz |
Ran ran; our contract draft was wrong, not the code |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("cdf07105af004930") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
torch.manual_seed(0)
# D is a 2D tensor used in matrix operations
# The function computes D.t() @ (D @ v) where v is a vector of shape (K,)
# So D should have shape (batch, K) where K is the number of columns
# Using distinct sizes: batch=2, K=4
D = torch.randn(2, 4, dtype=torch.float32)
ARGS = {
"D": D,
"n_power_iter": 10,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| hierarchical_losses |
Ran ran; our contract draft was wrong, not the code |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("61e3d435d25dd846") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, 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
torch.manual_seed(0)
# Batch size: 2, feature dimensions vary by layer
batch_size = 2
# Layer 0: codes[0] is (batch, code_dim_0), D[0] is (input_dim, code_dim_0)
# x is (batch, input_dim)
input_dim = 4
code_dim_0 = 3
# Layer 1: codes[1] is (batch, code_dim_1), D[1] is (code_dim_0, code_dim_1)
code_dim_1 = 5
x = torch.randn(batch_size, input_dim)
# Dictionary matrices
D0 = torch.randn(input_dim, code_dim_0)
D1 = torch.randn(code_dim_0, code_dim_1)
Ds = [D0, D1]
# Code vectors (sparse representations)
a0 = torch.randn(batch_size, code_dim_0)
a1 = torch.randn(batch_size, code_dim_1)
codes = [a0, a1]
# Sparsity penalties (one per layer)
lambdas = [0.1, 0.05]
# Reconstruction penalties for hierarchical layers (one per layer after first)
betas = [0.2]
ARGS = {
"x": x,
"Ds": Ds,
"codes": codes,
"lambdas": lambdas,
"betas": betas,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 1, dtype family 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
|
| infer_hsc_ista_nlayer |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("e07558afb92735ac") 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. 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)
# Set up small tensors and parameters for a 3-layer hierarchical sparse coding problem
B = 2 # batch size
D0_out = 4 # dictionary 0 output (code dimension)
D1_out = 3 # dictionary 1 output (code dimension)
D2_out = 2 # dictionary 2 output (code dimension)
x_dim = 5 # input dimension
# Create input data
x = torch.randn(B, x_dim, dtype=torch.float32)
# Create dictionaries
# D0: maps from code dim D0_out to x_dim
D0 = torch.randn(x_dim, D0_out, dtype=torch.float32)
# D1: maps from code dim D1_out to D0_out
D1 = torch.randn(D0_out, D1_out, dtype=torch.float32)
# D2: maps from code dim D2_out to D1_out
D2 = torch.randn(D1_out, D2_out, dtype=torch.float32)
Ds = [D0, D1, D2]
# Lambda parameters (sparsity penalty) for each layer
lambdas = [0.1, 0.05, 0.03]
# Beta parameters (hierarchical coupling) between layers
# Need len(betas) = max(L - 1, 0) = max(3 - 1, 0) = 2
betas = [0.5, 0.3]
# Optional parameters
T = 5 # number of iterations
eta_scale = 1.0
code_inits = None # will initialize to zero
etas = None # will be computed from Lipschitz constants
ARGS = {
"x": x,
"Ds": Ds,
"lambdas": lambdas,
"betas": betas,
"T": T,
"eta_scale": eta_scale,
"code_inits": code_inits,
"etas": etas,
}
- 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 — a list output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| infer_hsc_mfista_nlayer |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("316ca1f1bebd5ea1") 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. 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 math
torch.manual_seed(0)
# Small tensor dimensions
batch_size = 2
input_dim = 4
code_dim_1 = 3
code_dim_2 = 2
# Create input tensor x: (batch_size, input_dim)
x = torch.randn(batch_size, input_dim)
# Create dictionary matrices Ds
# D1: (input_dim, code_dim_1)
D1 = torch.randn(input_dim, code_dim_1)
# D2: (code_dim_1, code_dim_2)
D2 = torch.randn(code_dim_1, code_dim_2)
Ds = [D1, D2]
# Create lambda parameters (sparsity penalties) for each layer
lambdas = [0.1, 0.05]
# Create beta parameters (hierarchical coupling weights)
# For L layers, we need L-1 betas
betas = [0.2]
# Optional code initializations
code_inits = [
torch.randn(batch_size, code_dim_1),
torch.randn(batch_size, code_dim_2)
]
# Optional step sizes
etas = [0.1, 0.05]
# Number of iterations
T = 10
# Eta scale for automatic step size computation
eta_scale = 1.0
ARGS = {
'x': x,
'Ds': Ds,
'lambdas': lambdas,
'betas': betas,
'T': T,
'eta_scale': eta_scale,
'code_inits': code_inits,
'etas': etas
}
- 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 — a list output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| l1_batchmean |
Ran ran; our contract draft was wrong, not the code |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("d87358efd5078760") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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
torch.manual_seed(0)
# Create a small tensor with batch size 2 and feature dimension 4
# Shape: (batch_size=2, features=4)
a = torch.randn(2, 4)
ARGS = {
"a": a
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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
|
| soft_threshold |
Ran ran; our contract draft was wrong, not the code |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("d8930ceaf1d3a3e1") 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 tensor for the input
v = torch.randn(2, 4)
# Create a scalar threshold value
thr = 0.5
ARGS = {
"v": v,
"thr": thr,
}
- 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
|
| squared_frobenius_batchmean |
Ran ran; our contract draft was wrong, not the code |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("81f7f2b08d3346c8") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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
torch.manual_seed(0)
# Create small tensors for y_hat and y
# batch_size=2, feature_dim=4
y_hat = torch.randn(2, 4)
y = torch.randn(2, 4)
ARGS = {
"y_hat": y_hat,
"y": y,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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
|
| NLayerLISTA |
Not yet run unverified (harvested, no recorded run) |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("d6fdb66f6df7f4a4") How it ran |
| UnifiedHSCInference |
Not yet run unverified (harvested, no recorded run) |
KazuhisaFujita/HSC/HierarchicalSparseCoding.py code served (permissive licence) · get_code("b59075aba4dd3637") How it ran |