| ActNorm1d |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("7315468727393ef4") 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
import torch.nn as nn
class _ActNorm(nn.Module):
"""
Activation Normalization
Initialize the bias and scale with a given minibatch,
so that the output per-channel have zero mean and unit variance for that.
After initialization, `bias` and `logs` will be trained as parameters.
"""
def __init__(self, num_features, image_input, scale=1.0):
super().__init__()
param_size = [1, num_features, 1, 1] if image_input else [1, num_features]
self.bias = nn.Parameter(torch.zeros(*param_size))
self.logs = nn.Parameter(torch.zeros(*param_size))
self.num_features = num_features
self.scale = scale
self.inited = False
self.image_input = image_input
def initialize_parameters(self, sample):
if not self.training:
raise ValueError('In Eval mode, but ActNorm not initiated')
with torch.no_grad():
reduce_dim = [0, 2, 3] if self.image_input else 0
bias = -torch.mean(sample.clone(), dim=reduce_dim, keepdim=True)
var = torch.mean((sample.clone() + bias) ** 2, dim=reduce_dim, keepdim=True)
logs = torch.log(self.scale / (torch.sqrt(var) + 1e-06))
self.bias.data.copy_(bias.data)
self.logs.data.copy_(logs.data)
self.inited = True
def _center(self, sample, reverse=False):
if reverse:
return sample - self.bias
else:
return sample + self.bias
def _scale(self, sample, logdet=None, reverse=False):
if reverse:
sample = sample * torch.exp(-self.logs)
else:
sample = sample * torch.exp(self.logs)
if logdet is not None:
'\n logs is log_std of `mean of channels`\n so we need to multiply by number of pixels\n '
if self.image_input:
b, c, h, w = sample.shape
dlogdet = torch.sum(self.logs) * h * w
else:
b, c = sample.shape
dlogdet = torch.sum(self.logs)
if reverse:
dlogdet *= -1
logdet = logdet + dlogdet
return (sample, logdet)
def forward(self, sample, logdet=None, reverse=False):
self._check_input_dim(sample)
if not self.inited:
self.initialize_parameters(sample)
if reverse:
sample, logdet = self._scale(sample, logdet, reverse)
sample = self._center(sample, reverse)
else:
sample = self._center(sample, reverse)
sample, logdet = self._scale(sample, logdet, reverse)
return (sample, logdet)
class ActNorm1d(_ActNorm):
def __init__(self, num_features, scale=1.0):
super().__init__(num_features, False, scale)
def _check_input_dim(self, sample):
assert len(sample.size()) == 2
assert sample.size(1) == self.num_features, '[ActNorm]: input should be in shape as `BF`, feature size should be {} rather than {}'.format(self.num_features, sample.size())
INIT_ARGS = {
'num_features': 4,
'scale': 1.0
}
ARGS = {
'sample': torch.randn(2, 4),
'logdet': None,
'reverse': False
}
- 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)
|
| ActNorm2d |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("5dfed0f3161fd4b1") 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
import torch.nn as nn
class _ActNorm(nn.Module):
"""
Activation Normalization
Initialize the bias and scale with a given minibatch,
so that the output per-channel have zero mean and unit variance for that.
After initialization, `bias` and `logs` will be trained as parameters.
"""
def __init__(self, num_features, image_input, scale=1.0):
super().__init__()
param_size = [1, num_features, 1, 1] if image_input else [1, num_features]
self.bias = nn.Parameter(torch.zeros(*param_size))
self.logs = nn.Parameter(torch.zeros(*param_size))
self.num_features = num_features
self.scale = scale
self.inited = False
self.image_input = image_input
def initialize_parameters(self, sample):
if not self.training:
raise ValueError('In Eval mode, but ActNorm not initiated')
with torch.no_grad():
reduce_dim = [0, 2, 3] if self.image_input else 0
bias = -torch.mean(sample.clone(), dim=reduce_dim, keepdim=True)
var = torch.mean((sample.clone() + bias) ** 2, dim=reduce_dim, keepdim=True)
logs = torch.log(self.scale / (torch.sqrt(var) + 1e-06))
self.bias.data.copy_(bias.data)
self.logs.data.copy_(logs.data)
self.inited = True
def _center(self, sample, reverse=False):
if reverse:
return sample - self.bias
else:
return sample + self.bias
def _scale(self, sample, logdet=None, reverse=False):
if reverse:
sample = sample * torch.exp(-self.logs)
else:
sample = sample * torch.exp(self.logs)
if logdet is not None:
'\n logs is log_std of `mean of channels`\n so we need to multiply by number of pixels\n '
if self.image_input:
b, c, h, w = sample.shape
dlogdet = torch.sum(self.logs) * h * w
else:
b, c = sample.shape
dlogdet = torch.sum(self.logs)
if reverse:
dlogdet *= -1
logdet = logdet + dlogdet
return (sample, logdet)
def forward(self, sample, logdet=None, reverse=False):
self._check_input_dim(sample)
if not self.inited:
self.initialize_parameters(sample)
if reverse:
sample, logdet = self._scale(sample, logdet, reverse)
sample = self._center(sample, reverse)
else:
sample = self._center(sample, reverse)
sample, logdet = self._scale(sample, logdet, reverse)
return (sample, logdet)
class ActNorm2d(_ActNorm):
def __init__(self, num_features, scale=1.0):
super().__init__(num_features, True, scale)
def _check_input_dim(self, sample):
assert len(sample.size()) == 4
assert sample.size(1) == self.num_features, '[ActNorm]: input should be in shape as `BCHW`, channels should be {} rather than {}'.format(self.num_features, sample.size())
INIT_ARGS = {
'num_features': 4,
'scale': 1.0,
}
ARGS = {
'sample': torch.randn(2, 4, 3, 5),
'logdet': torch.tensor(0.0),
'reverse': False,
}
- 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)
|
| BatchNorm |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("84ebb2409e0a1cc7") 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
import torch.nn as nn
class BatchNorm(nn.Module):
"""
RealNVP BatchNorm layer
"""
def __init__(self, input_size, momentum=0.9, eps=1e-05):
super().__init__()
self.momentum = momentum
self.eps = eps
self.log_gamma = nn.Parameter(torch.zeros(input_size))
self.beta = nn.Parameter(torch.zeros(input_size))
self.register_buffer('running_mean', torch.zeros(input_size))
self.register_buffer('running_var', torch.ones(input_size))
self.register_buffer('batch_mean', torch.zeros(input_size))
self.register_buffer('batch_var', torch.zeros(input_size))
def forward(self, x):
if self.training:
self.batch_mean = x.mean(0)
self.batch_var = x.var(0)
self.running_mean.mul_(self.momentum).add_(self.batch_mean.data * (1 - self.momentum))
self.running_var.mul_(self.momentum).add_(self.batch_var.data * (1 - self.momentum))
mean = self.batch_mean
var = self.batch_var
else:
mean = self.running_mean
var = self.running_var
x_hat = (x - mean) / torch.sqrt(var + self.eps)
y = self.log_gamma.exp() * x_hat + self.beta
log_abs_det_jacobian = self.log_gamma - 0.5 * torch.log(var + self.eps)
return (y, torch.sum(log_abs_det_jacobian.expand_as(x), dim=1))
def inverse(self, y):
if self.training:
mean = self.batch_mean
var = self.batch_var
else:
mean = self.running_mean
var = self.running_var
x_hat = (y - self.beta) * torch.exp(-self.log_gamma)
x = x_hat * torch.sqrt(var + self.eps) + mean
log_abs_det_jacobian = 0.5 * torch.log(var + self.eps) - self.log_gamma
return (x, torch.sum(log_abs_det_jacobian.expand_as(x), dim=1))
INIT_ARGS = {
'input_size': 4,
'momentum': 0.9,
'eps': 1e-05
}
ARGS = {
'x': torch.randn(2, 4)
}
if __name__ == '__main__':
bn = BatchNorm(**INIT_ARGS)
bn.train()
y, log_det = bn(**ARGS)
print("Forward output shape:", y.shape)
print("Log det jacobian shape:", log_det.shape)
bn.eval()
y_eval, log_det_eval = bn(**ARGS)
print("Eval forward output shape:", y_eval.shape)
print("Eval log det jacobian shape:", log_det_eval.shape)
x_inv, log_det_inv = bn.inverse(y)
print("Inverse output shape:", x_inv.shape)
print("Inverse log det jacobian shape:", log_det_inv.shape)
- 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)
|
| Conv2d |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("2d7d6fd92e4989a5") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
INIT_ARGS = {
'in_dim': 3,
'out_dim': 5,
'kernel_size': (3, 3),
'stride': (1, 1),
'padding': 'same',
'do_actnorm': True,
'weight_std': 0.05
}
ARGS = {
'sample': torch.randn(2, 3, 8, 8)
}
- 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 4, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:RuntimeError)
- 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)
|
| Conv2dZeros |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("eeed4e16d893cea5") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 8, 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 torch
import torch.nn as nn
def compute_same_pad(kernel_size, stride):
if isinstance(kernel_size, int):
kernel_size = [kernel_size]
if isinstance(stride, int):
stride = [stride]
assert len(stride) == len(kernel_size), 'Pass kernel size and stride both as int, or both as equal length iterable'
return [((k - 1) * s + 1) // 2 for k, s in zip(kernel_size, stride)]
class Conv2dZeros(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=(3, 3), stride=(1, 1), padding='same', logscale_factor=3):
super().__init__()
if padding == 'same':
padding = compute_same_pad(kernel_size, stride)
elif padding == 'valid':
padding = 0
self.conv = nn.Conv2d(in_dim, out_dim, kernel_size, stride, padding)
self.conv.weight.data.zero_()
self.conv.bias.data.zero_()
self.logscale_factor = logscale_factor
self.logs = nn.Parameter(torch.zeros(out_dim, 1, 1))
def forward(self, sample):
output = self.conv(sample)
return output * torch.exp(self.logs * self.logscale_factor)
INIT_ARGS = {
'in_dim': 3,
'out_dim': 4,
'kernel_size': (3, 3),
'stride': (1, 1),
'padding': 'same',
'logscale_factor': 3
}
ARGS = {
'sample': torch.randn(2, 3, 8, 8)
}
if __name__ == '__main__':
model = Conv2dZeros(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output dtype: {output.dtype}")
- 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 4, dtype family float, shape (2, 4, 8, 8) — shape (2, 4, 8, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| InvertibleConv1x1 |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("5c8a917425f0def4") 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
import torch.nn as nn
import torch.nn.functional as F
class InvertibleConv1x1(nn.Module):
def __init__(self, num_dim, LU_decomposed):
super().__init__()
w_shape = [num_dim, num_dim]
w_init = torch.qr(torch.randn(*w_shape))[0]
if not LU_decomposed:
self.weight = nn.Parameter(torch.Tensor(w_init))
else:
p, lower, upper = torch.lu_unpack(*torch.lu(w_init))
s = torch.diag(upper)
sign_s = torch.sign(s)
log_s = torch.log(torch.abs(s))
upper = torch.triu(upper, 1)
l_mask = torch.tril(torch.ones(w_shape), -1)
eye = torch.eye(*w_shape)
self.register_buffer('p', p)
self.register_buffer('sign_s', sign_s)
self.lower = nn.Parameter(lower)
self.log_s = nn.Parameter(log_s)
self.upper = nn.Parameter(upper)
self.l_mask = l_mask
self.eye = eye
self.w_shape = w_shape
self.LU_decomposed = LU_decomposed
def get_weight(self, sample, reverse):
b, c, h, w = sample.shape
if not self.LU_decomposed:
dlogdet = torch.slogdet(self.weight)[1] * h * w
if reverse:
weight = torch.inverse(self.weight)
else:
weight = self.weight
else:
self.l_mask = self.l_mask.to(sample.device)
self.eye = self.eye.to(sample.device)
lower = self.lower * self.l_mask + self.eye
u = self.upper * self.l_mask.transpose(0, 1).contiguous()
u += torch.diag(self.sign_s * torch.exp(self.log_s))
dlogdet = torch.sum(self.log_s) * h * w
if reverse:
u_inv = torch.inverse(u)
l_inv = torch.inverse(lower)
p_inv = torch.inverse(self.p)
weight = torch.matmul(u_inv, torch.matmul(l_inv, p_inv))
else:
weight = torch.matmul(self.p, torch.matmul(lower, u))
return (weight.view(self.w_shape[0], self.w_shape[1], 1, 1), dlogdet)
def forward(self, sample, logdet=None, reverse=False):
"""
log-det = log|abs(|W|)| * pixels
"""
weight, dlogdet = self.get_weight(sample, reverse)
if not reverse:
z = F.conv2d(sample, weight)
if logdet is not None:
logdet = logdet + dlogdet
return (z, logdet)
else:
z = F.conv2d(sample, weight)
if logdet is not None:
logdet = logdet - dlogdet
return (z, logdet)
INIT_ARGS = {
'num_dim': 4,
'LU_decomposed': True
}
ARGS = {
'sample': torch.randn(2, 4, 3, 3),
'logdet': torch.tensor(0.0),
'reverse': False
}
if __name__ == '__main__':
model = InvertibleConv1x1(**INIT_ARGS)
output, logdet_out = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Logdet output: {logdet_out}")
- 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)
|
| LinearZeros |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("11e0e1eaee63a699") 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 torch
import torch.nn as nn
class LinearZeros(nn.Module):
def __init__(self, in_dim, out_dim, logscale_factor=3):
super().__init__()
self.linear = nn.Linear(in_dim, out_dim)
self.linear.weight.data.zero_()
self.linear.bias.data.zero_()
self.logscale_factor = logscale_factor
self.logs = nn.Parameter(torch.zeros(out_dim))
def forward(self, sample):
output = self.linear(sample)
return output * torch.exp(self.logs * self.logscale_factor)
INIT_ARGS = {
'in_dim': 4,
'out_dim': 3,
'logscale_factor': 3
}
ARGS = {
'sample': torch.randn(2, 4)
}
if __name__ == '__main__':
model = LinearZeros(**INIT_ARGS)
result = model(**ARGS)
print(f"Output shape: {result.shape}")
print(f"Output: {result}")
- 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)
|
| Permute1d |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("ec45833a8bb10b3c") 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, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
class PermuteNd(nn.Module):
def __init__(self, num_dim, shuffle):
super().__init__()
self.num_dim = num_dim
self.indices = torch.arange(self.num_dim - 1, -1, -1, dtype=torch.long)
self.indices_inverse = torch.zeros(self.num_dim, dtype=torch.long)
for i in range(self.num_dim):
self.indices_inverse[self.indices[i]] = i
if shuffle:
self.reset_indices()
def reset_indices(self):
shuffle_idx = torch.randperm(self.indices.shape[0])
self.indices = self.indices[shuffle_idx]
for i in range(self.num_dim):
self.indices_inverse[self.indices[i]] = i
def forward(self, forward, reverse=False):
pass
class Permute1d(PermuteNd):
def __init__(self, num_dim, shuffle):
super().__init__(num_dim, shuffle)
def forward(self, sample, reverse=False):
assert len(sample.size()) == 2
if not reverse:
sample = sample[:, self.indices]
return sample
else:
return sample[:, self.indices_inverse]
INIT_ARGS = {
'num_dim': 4,
'shuffle': False
}
ARGS = {
'sample': torch.randn(2, 4),
'reverse': False
}
- 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, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| Permute2d |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("3884e401a1dea604") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) 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
class PermuteNd(nn.Module):
def __init__(self, num_dim, shuffle):
super().__init__()
self.num_dim = num_dim
self.indices = torch.arange(self.num_dim - 1, -1, -1, dtype=torch.long)
self.indices_inverse = torch.zeros(self.num_dim, dtype=torch.long)
for i in range(self.num_dim):
self.indices_inverse[self.indices[i]] = i
if shuffle:
self.reset_indices()
def reset_indices(self):
shuffle_idx = torch.randperm(self.indices.shape[0])
self.indices = self.indices[shuffle_idx]
for i in range(self.num_dim):
self.indices_inverse[self.indices[i]] = i
def forward(self, forward, reverse=False):
pass
class Permute2d(PermuteNd):
def __init__(self, num_dim, shuffle):
super().__init__(num_dim, shuffle)
def forward(self, sample, reverse=False):
assert len(sample.size()) == 4
if not reverse:
sample = sample[:, self.indices, :, :]
return sample
else:
return sample[:, self.indices_inverse, :, :]
INIT_ARGS = {
'num_dim': 4,
'shuffle': True,
}
ARGS = {
'sample': torch.randn(2, 4, 3, 5),
'reverse': False,
}
if __name__ == '__main__':
model = Permute2d(**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 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 5) 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)
|
| PermuteNd |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("d6de36917b79ca67") 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 NoneType. 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
class PermuteNd(nn.Module):
def __init__(self, num_dim, shuffle):
super().__init__()
self.num_dim = num_dim
self.indices = torch.arange(self.num_dim - 1, -1, -1, dtype=torch.long)
self.indices_inverse = torch.zeros(self.num_dim, dtype=torch.long)
for i in range(self.num_dim):
self.indices_inverse[self.indices[i]] = i
if shuffle:
self.reset_indices()
def reset_indices(self):
shuffle_idx = torch.randperm(self.indices.shape[0])
self.indices = self.indices[shuffle_idx]
for i in range(self.num_dim):
self.indices_inverse[self.indices[i]] = i
def forward(self, forward, reverse=False):
pass
INIT_ARGS = {
'num_dim': 4,
'shuffle': False
}
ARGS = {
'forward': torch.randn(2, 3, 5, 7),
'reverse': False
}
if __name__ == '__main__':
model = PermuteNd(**INIT_ARGS)
output = model(**ARGS)
print("Model created and called successfully")
print(f"Model indices: {model.indices}")
print(f"Model indices_inverse: {model.indices_inverse}")
- 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 NoneType — a NoneType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NoneType 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| ReLUNet |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("b27b3f12e9fea1e8") 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 torch
import torch.nn as nn
class ReLUNet(nn.Module):
"""
Simple fully connected neural network with ReLU activations.
TODO: change this to a Fully Connected Network with a activation passed as an argument
"""
def __init__(self, in_dim, out_dim, hidden_dim, num_layers=1):
super().__init__()
layers = []
layers += [nn.Linear(in_dim, hidden_dim)]
layers += []
for i in range(num_layers):
layers += [nn.ReLU(), nn.Linear(hidden_dim, hidden_dim)]
layers += [nn.ReLU(), nn.Linear(hidden_dim, out_dim)]
self.network = nn.Sequential(*layers)
def forward(self, x):
return self.network(x)
INIT_ARGS = {
'in_dim': 4,
'out_dim': 3,
'hidden_dim': 8,
'num_layers': 2,
}
ARGS = {
'x': torch.randn(2, 4),
}
if __name__ == '__main__':
model = ReLUNet(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Expected shape: (2, 3)")
- 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)
|
| RealNVP |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("55233dad2a63c90e") 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
import torch.nn as nn
def split_feature(tensor, type='split'):
"""
type = ["split", "cross"]
"""
image_input = len(tensor.size()) > 2
C = tensor.size(1)
if image_input:
if type == 'split':
return (tensor[:, :C // 2, ...], tensor[:, C // 2:, ...])
elif type == 'cross':
return (tensor[:, 0::2, ...], tensor[:, 1::2, ...])
elif type == 'split':
return (tensor[:, :C // 2], tensor[:, C // 2:])
elif type == 'cross':
return (tensor[:, 0::2], tensor[:, 1::2])
class RealNVP(nn.Module):
"""
Non-volume preserving flow.
[Dinh et. al. 2017]
Contains coupling layers, representating one RealNVP flow step
"""
def __init__(self):
super().__init__()
def forward(self, x, layers):
(t_net, s_net, batch_norm), flipped = layers
if batch_norm is not None:
x, bn_ldj = batch_norm(x)
else:
bn_ldj = 0.0
if flipped:
z2, z1 = split_feature(x, 'split')
else:
z1, z2 = split_feature(x, 'split')
shift = t_net(z1)
scale = s_net(z1)
z2 = shift + z2 * torch.exp(scale)
z = torch.cat([z1, z2], dim=1)
log_det = torch.sum(scale, dim=1) + bn_ldj
return (z, log_det)
def inverse(self, z, layers):
(t_net, s_net, batch_norm), flipped = layers
if flipped:
x1, x2 = split_feature(z, 'split')
else:
x2, x1 = split_feature(z, 'split')
shift = t_net(x2)
scale = s_net(x2)
x1 = (x1 - shift) * torch.exp(-scale)
x = torch.cat([x1, x2], dim=1)
log_det = torch.sum(-scale, dim=1)
if batch_norm is not None:
x, bn_ldj = batch_norm.inverse(x)
log_det = log_det + bn_ldj
return (x, log_det)
class SimpleNet(nn.Module):
def __init__(self, in_dim, out_dim):
super().__init__()
self.net = nn.Sequential(
nn.Linear(in_dim, 8),
nn.ReLU(),
nn.Linear(8, out_dim)
)
def forward(self, x):
return self.net(x)
INIT_ARGS = {}
t_net = SimpleNet(2, 2)
s_net = SimpleNet(2, 2)
batch_norm = None
layers = ((t_net, s_net, batch_norm), False)
ARGS = {
'x': torch.randn(2, 4),
'layers': layers
}
if __name__ == '__main__':
model = RealNVP(**INIT_ARGS)
z, log_det = model(**ARGS)
print("Forward output shape:", z.shape)
print("Log determinant shape:", log_det.shape)
print("Forward pass successful")
x_reconstructed, log_det_inv = model.inverse(z, layers)
print("Inverse output shape:", x_reconstructed.shape)
print("Inverse log determinant shape:", log_det_inv.shape)
print("Inverse pass successful")
- 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)
|
| ResidualBlock |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("0a7417c78d382ffd") 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, 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 torch
import torch.nn as nn
INIT_ARGS = {
'hidden_dim': 8,
'use_batch_norm': True,
'zero_initialization': True,
}
ARGS = {
'inputs': torch.randn(2, 8),
}
if __name__ == '__main__':
block = nn.Module()
block.__class__ = type('ResidualBlock', (nn.Module,), {
'__init__': lambda self, hidden_dim, use_batch_norm=True, zero_initialization=True: (
super(type(self), self).__init__(),
setattr(self, 'activation', nn.ReLU()),
setattr(self, 'linear_layers', nn.ModuleList([nn.Linear(hidden_dim, hidden_dim) for _ in range(2)])),
(lambda: (
nn.init.uniform_(self.linear_layers[-1].weight, -0.001, 0.001),
nn.init.uniform_(self.linear_layers[-1].bias, -0.001, 0.001)
))() if zero_initialization else None
)[-1],
'forward': lambda self, inputs: (
lambda temps: inputs + temps
)(self.linear_layers[1](self.activation(self.linear_layers[0](self.activation(inputs)))))
})
residual_block = nn.Module.__new__(nn.Module)
residual_block.__class__ = type('ResidualBlock', (nn.Module,), {
'__init__': lambda self, hidden_dim, use_batch_norm=True, zero_initialization=True: (
nn.Module.__init__(self),
setattr(self, 'activation', nn.ReLU()),
setattr(self, 'linear_layers', nn.ModuleList([nn.Linear(hidden_dim, hidden_dim) for _ in range(2)])),
(nn.init.uniform_(self.linear_layers[-1].weight, -0.001, 0.001),
nn.init.uniform_(self.linear_layers[-1].bias, -0.001, 0.001)) if zero_initialization else None
),
'forward': lambda self, inputs: (
lambda temps: inputs + temps
)(self.linear_layers[1](self.activation(self.linear_layers[0](self.activation(inputs)))))
})
class ResidualBlock(nn.Module):
def __init__(self, hidden_dim, use_batch_norm=True, zero_initialization=True):
super().__init__()
self.activation = nn.ReLU()
self.linear_layers = nn.ModuleList([nn.Linear(hidden_dim, hidden_dim) for _ in range(2)])
if zero_initialization:
nn.init.uniform_(self.linear_layers[-1].weight, -0.001, 0.001)
nn.init.uniform_(self.linear_layers[-1].bias, -0.001, 0.001)
def forward(self, inputs):
temps = inputs
temps = self.activation(temps)
temps = self.linear_layers[0](temps)
temps = self.activation(temps)
temps = self.linear_layers[1](temps)
return inputs + temps
block = ResidualBlock(**INIT_ARGS)
output = block(**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, 8) — shape (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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| ResidualNet |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("28dd15935b6ad2c2") 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 torch
import torch.nn as nn
INIT_ARGS = {
'in_dim': 4,
'out_dim': 3,
'hidden_dim': 8,
'num_layers': 2,
}
ARGS = {
'inputs': torch.randn(2, 4),
}
- 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)
|
| Split2d |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("b46eb8d0c2c169c9") 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
import torch.nn as nn
def compute_same_pad(kernel_size, stride):
if isinstance(kernel_size, int):
kernel_size = [kernel_size]
if isinstance(stride, int):
stride = [stride]
assert len(stride) == len(kernel_size), 'Pass kernel size and stride both as int, or both as equal length iterable'
return [((k - 1) * s + 1) // 2 for k, s in zip(kernel_size, stride)]
def log_normal_diag(x, mean, log_var, average=False, reduce=True, dim=None):
log_norm = -0.5 * (log_var + (x - mean) * (x - mean) * log_var.exp().reciprocal())
if reduce:
if average:
return torch.mean(log_norm, dim)
else:
return torch.sum(log_norm, dim)
else:
return log_norm
def split_feature(tensor, type='split'):
"""
type = ["split", "cross"]
"""
image_input = len(tensor.size()) > 2
C = tensor.size(1)
if image_input:
if type == 'split':
return (tensor[:, :C // 2, ...], tensor[:, C // 2:, ...])
elif type == 'cross':
return (tensor[:, 0::2, ...], tensor[:, 1::2, ...])
elif type == 'split':
return (tensor[:, :C // 2], tensor[:, C // 2:])
elif type == 'cross':
return (tensor[:, 0::2], tensor[:, 1::2])
class Conv2dZeros(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=(3, 3), stride=(1, 1), padding='same', logscale_factor=3):
super().__init__()
if padding == 'same':
padding = compute_same_pad(kernel_size, stride)
elif padding == 'valid':
padding = 0
self.conv = nn.Conv2d(in_dim, out_dim, kernel_size, stride, padding)
self.conv.weight.data.zero_()
self.conv.bias.data.zero_()
self.logscale_factor = logscale_factor
self.logs = nn.Parameter(torch.zeros(out_dim, 1, 1))
def forward(self, sample):
output = self.conv(sample)
return output * torch.exp(self.logs * self.logscale_factor)
class Split2d(nn.Module):
def __init__(self, in_dim):
super().__init__()
self.conv = Conv2dZeros(in_dim // 2, in_dim)
def split2d_prior(self, z):
h = self.conv(z)
return split_feature(h, 'cross')
def forward(self, sample, logdet=0.0, reverse=False, temperature=None):
if reverse:
z1 = sample
z_mu, z_var = self.split2d_prior(z1)
z2 = torch.normal(z_mu, torch.exp(z_var) * temperature)
z = torch.cat((z1, z2), dim=1)
return (z, logdet)
else:
z1, z2 = split_feature(sample, 'split')
z_mu, z_var = self.split2d_prior(z1)
logdet = log_normal_diag(z2, z_mu, z_var, dim=[1, 2, 3]) + logdet
return (z1, logdet)
INIT_ARGS = {
'in_dim': 8
}
ARGS = {
'sample': torch.randn(2, 8, 4, 3),
'logdet': 0.0,
'reverse': False,
'temperature': 1.0
}
if __name__ == '__main__':
model = Split2d(**INIT_ARGS)
output = model(**ARGS)
print("Output:", output)
print("Output[0] shape:", output[0].shape)
print("Output[1] shape:", output[1].shape)
- 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)
|
| SqueezeLayer |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("825e0d0a10f8281b") 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
import torch.nn as nn
def squeeze2d(input, factor):
if factor == 1:
return input
B, C, H, W = input.size()
assert H % factor == 0 and W % factor == 0, 'H or W modulo factor is not 0'
x = input.view(B, C, H // factor, factor, W // factor, factor)
x = x.permute(0, 1, 3, 5, 2, 4).contiguous()
x = x.view(B, C * factor * factor, H // factor, W // factor)
return x
def unsqueeze2d(input, factor):
if factor == 1:
return input
factor2 = factor ** 2
B, C, H, W = input.size()
assert C % factor2 == 0, 'C module factor squared is not 0'
x = input.view(B, C // factor2, factor, factor, H, W)
x = x.permute(0, 1, 4, 2, 5, 3).contiguous()
x = x.view(B, C // factor2, H * factor, W * factor)
return x
class SqueezeLayer(nn.Module):
def __init__(self, factor):
super().__init__()
self.factor = factor
def forward(self, sample, logdet=None, reverse=False):
if reverse:
output = unsqueeze2d(sample, self.factor)
else:
output = squeeze2d(sample, self.factor)
return (output, logdet)
INIT_ARGS = {
'factor': 2
}
ARGS = {
'sample': torch.randn(2, 4, 8, 6),
'logdet': None,
'reverse': False
}
if __name__ == '__main__':
layer = SqueezeLayer(**INIT_ARGS)
output, logdet = layer(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Logdet: {logdet}")
ARGS['reverse'] = True
ARGS['sample'] = torch.randn(2, 16, 4, 3)
output, logdet = layer(**ARGS)
print(f"Output shape (reversed): {output.shape}")
print(f"Logdet (reversed): {logdet}")
- 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)
|
| TanhNet |
Ran ran on a synthesized input |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("45e491a0b611d3dc") 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 torch
import torch.nn as nn
class TanhNet(nn.Module):
def __init__(self, in_dim, out_dim, hidden_dim, num_layers=1):
super().__init__()
layers = []
layers += [nn.Linear(in_dim, hidden_dim)]
for i in range(num_layers):
layers += [nn.Tanh(), nn.Linear(hidden_dim, hidden_dim)]
layers += [nn.Tanh(), nn.Linear(hidden_dim, out_dim)]
self.network = nn.Sequential(*layers)
def forward(self, x):
return self.network(x)
INIT_ARGS = {
'in_dim': 4,
'out_dim': 3,
'hidden_dim': 8,
'num_layers': 2,
}
ARGS = {
'x': torch.randn(2, 4),
}
model = TanhNet(**INIT_ARGS)
output = model(**ARGS)
- 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)
|
| log_normal_diag |
Ran ran; our contract draft was wrong, not the code |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("de88c452ca85eb2d") 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 the function
batch_size = 2
dim = 4
x = torch.randn(batch_size, dim)
mean = torch.randn(batch_size, dim)
log_var = torch.randn(batch_size, dim)
ARGS = {
"x": x,
"mean": mean,
"log_var": log_var,
"average": False,
"reduce": True,
"dim": None,
}
- 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
|
| log_normal_standard |
Ran ran; our contract draft was wrong, not the code |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("6ee1f71f50ee4b26") 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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 math
torch.manual_seed(0)
# Create a small tensor for x parameter
x = torch.randn(2, 4)
# Create arguments dict
ARGS = {
'x': x,
'average': False,
'reduce': True,
'dim': None,
'device': None
}
- 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
|
| split_feature |
Ran ran; our contract draft was wrong, not the code |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("45f3824dcc7faec1") 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 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
torch.manual_seed(0)
# Test case 1: image input with 'split' type
# tensor shape: (batch=2, channels=4, height=3, width=3)
tensor_image_split = torch.randn(2, 4, 3, 3)
# Test case 2: image input with 'cross' type
tensor_image_cross = torch.randn(2, 4, 3, 3)
# Test case 3: non-image input with 'split' type
# tensor shape: (batch=2, features=4)
tensor_non_image_split = torch.randn(2, 4)
# Test case 4: non-image input with 'cross' type
tensor_non_image_cross = torch.randn(2, 4)
# Use the first test case as the primary argument
ARGS = {
'tensor': tensor_image_split,
'type': 'split'
}
- 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 5, dtype family float — a tuple output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| BoostedFlow |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("639270ba7c0b6ccd") How it ran |
| ConvNet |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("85e265af1f8b4721") How it ran |
| FlowNet |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("e898fc9ab950c09b") How it ran |
| FlowStep |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("cfe3b31cd1ff04b1") How it ran |
| GenerativeFlow |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("3b26d29c4a8c9004") How it ran |
| Glow |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("832c9c612efadf21") How it ran |
| RealNVPFlow |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("bd9b9fc7030ba799") How it ran |
| _ActNorm |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("0e3e13be358d4e88") How it ran |
| _Dequantization |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/models/boosted_flow.py code served (permissive licence) · get_code("1ec304d03cf1726b") How it ran |
| epoch_reporting |
Not yet run unverified (harvested, no recorded run) |
robert-giaquinto/gradient-boosted-normalizing-flows/density_experiment.py code served (permissive licence) · get_code("ebb3df3128ed7f4a") How it ran |